diff --git a/packages/google-cloud-networksecurity/.eslintignore b/packages/google-cloud-networksecurity/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-networksecurity/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-networksecurity/.eslintrc.json b/packages/google-cloud-networksecurity/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-networksecurity/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-networksecurity/README.md b/packages/google-cloud-networksecurity/README.md index 857f0b1bda3d..0cbca1c598ce 100644 --- a/packages/google-cloud-networksecurity/README.md +++ b/packages/google-cloud-networksecurity/README.md @@ -74,14 +74,19 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | update dns threat detector | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/dns_threat_detector_service.update_dns_threat_detector.js) | | create firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_firewall_endpoint.js) | | create firewall endpoint association | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_firewall_endpoint_association.js) | +| create project firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_project_firewall_endpoint.js) | | delete firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_firewall_endpoint.js) | | delete firewall endpoint association | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_firewall_endpoint_association.js) | +| delete project firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_project_firewall_endpoint.js) | | get firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_firewall_endpoint.js) | | get firewall endpoint association | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_firewall_endpoint_association.js) | +| get project firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_project_firewall_endpoint.js) | | list firewall endpoint associations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_firewall_endpoint_associations.js) | | list firewall endpoints | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_firewall_endpoints.js) | +| list project firewall endpoints | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_project_firewall_endpoints.js) | | update firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_firewall_endpoint.js) | | update firewall endpoint association | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_firewall_endpoint_association.js) | +| update project firewall endpoint | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_project_firewall_endpoint.js) | | create intercept deployment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/intercept.create_intercept_deployment.js) | | create intercept deployment group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/intercept.create_intercept_deployment_group.js) | | create intercept endpoint group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/intercept.create_intercept_endpoint_group.js) | @@ -186,6 +191,24 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | list security profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/organization_security_profile_group_service.list_security_profiles.js) | | update security profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/organization_security_profile_group_service.update_security_profile.js) | | update security profile group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/organization_security_profile_group_service.update_security_profile_group.js) | +| create s a c attachment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_attachment.js) | +| create s a c realm | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_realm.js) | +| delete s a c attachment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_attachment.js) | +| delete s a c realm | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_realm.js) | +| get s a c attachment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_attachment.js) | +| get s a c realm | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_realm.js) | +| list s a c attachments | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_attachments.js) | +| list s a c realms | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_realms.js) | +| create security profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile.js) | +| create security profile group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile_group.js) | +| delete security profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile.js) | +| delete security profile group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile_group.js) | +| get security profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile.js) | +| get security profile group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile_group.js) | +| list security profile groups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profile_groups.js) | +| list security profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profiles.js) | +| update security profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile.js) | +| update security profile group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile_group.js) | | cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1/snippet_metadata_google.cloud.networksecurity.v1.json) | | create dns threat detector | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1alpha1/dns_threat_detector_service.create_dns_threat_detector.js) | | delete dns threat detector | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/samples/generated/v1alpha1/dns_threat_detector_service.delete_dns_threat_detector.js) | @@ -371,7 +394,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -381,7 +404,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networksecurity/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/authz_policy.proto b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/authz_policy.proto index 1a8c29bbcf36..e3aed69c5fb4 100644 --- a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/authz_policy.proto +++ b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/authz_policy.proto @@ -43,15 +43,18 @@ message AuthzPolicy { // Specifies the set of targets to which this policy should be applied to. message Target { // Optional. All gateways and forwarding rules referenced by this policy and - // extensions must share the same load balancing scheme. Supported values: + // extensions must share the same load balancing scheme. Required only when + // targeting forwarding rules. If targeting Secure Web Proxy, this field + // must be `INTERNAL_MANAGED` or not specified. Must not be specified + // when targeting Agent Gateway. Supported values: // `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer // to [Backend services // overview](https://cloud.google.com/load-balancing/docs/backend-service). LoadBalancingScheme load_balancing_scheme = 8 [(google.api.field_behavior) = OPTIONAL]; - // Required. A list of references to the Forwarding Rules on which this - // policy will be applied. + // Required. A list of references to the Forwarding Rules, Secure Web Proxy + // Gateways, or Agent Gateways on which this policy will be applied. repeated string resources = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -340,6 +343,13 @@ message AuthzPolicy { // request will be denied. This field can be set only for AuthzPolicies // targeting AgentGateway resources. MCP mcp = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of SNIs to match against. The match can be one of + // exact, prefix, suffix, or contains (substring match). If there is no + // SNI (i.e. plaintext HTTP traffic), the request will be denied. + // Matches are always case sensitive unless the ignoreCase is set. + // Limited to 10 SNIs per Authorization Policy. + repeated StringMatch snis = 7 [(google.api.field_behavior) = OPTIONAL]; } // Optional. Describes properties of one or more targets of a request. At @@ -500,6 +510,15 @@ message AuthzPolicy { // to 5 rules. repeated AuthzRule http_rules = 7 [(google.api.field_behavior) = OPTIONAL]; + // Optional. A list of authorization network rules to match against the + // incoming request. A policy match occurs when at least one network rule + // matches the request. + // At least one network rule is required for Allow or Deny Action if no HTTP + // rules are provided. Network rules are mutually exclusive with HTTP rules. + // Limited to 5 rules. + repeated AuthzRule network_rules = 12 + [(google.api.field_behavior) = OPTIONAL]; + // Required. Can be one of `ALLOW`, `DENY`, `CUSTOM`. // // When the action is `CUSTOM`, `customProvider` must be specified. diff --git a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/firewall_activation.proto b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/firewall_activation.proto index a965f589b764..6e38aac9f99d 100644 --- a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/firewall_activation.proto +++ b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/firewall_activation.proto @@ -53,6 +53,15 @@ service FirewallActivation { option (google.api.method_signature) = "parent"; } + // Lists FirewallEndpoints in a given project and location. + rpc ListProjectFirewallEndpoints(ListFirewallEndpointsRequest) + returns (ListFirewallEndpointsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/firewallEndpoints" + }; + option (google.api.method_signature) = "parent"; + } + // Gets details of a single org Endpoint. rpc GetFirewallEndpoint(GetFirewallEndpointRequest) returns (FirewallEndpoint) { @@ -62,6 +71,15 @@ service FirewallActivation { option (google.api.method_signature) = "name"; } + // Gets details of a single project Endpoint. + rpc GetProjectFirewallEndpoint(GetFirewallEndpointRequest) + returns (FirewallEndpoint) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/firewallEndpoints/*}" + }; + option (google.api.method_signature) = "name"; + } + // Creates a new FirewallEndpoint in a given organization and location. rpc CreateFirewallEndpoint(CreateFirewallEndpointRequest) returns (google.longrunning.Operation) { @@ -77,6 +95,21 @@ service FirewallActivation { }; } + // Creates a new FirewallEndpoint in a given project and location. + rpc CreateProjectFirewallEndpoint(CreateFirewallEndpointRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/firewallEndpoints" + body: "firewall_endpoint" + }; + option (google.api.method_signature) = + "parent,firewall_endpoint,firewall_endpoint_id"; + option (google.longrunning.operation_info) = { + response_type: "FirewallEndpoint" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + // Deletes a single org Endpoint. rpc DeleteFirewallEndpoint(DeleteFirewallEndpointRequest) returns (google.longrunning.Operation) { @@ -90,6 +123,19 @@ service FirewallActivation { }; } + // Deletes a single project Endpoint. + rpc DeleteProjectFirewallEndpoint(DeleteFirewallEndpointRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/firewallEndpoints/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + // Update a single org Endpoint. rpc UpdateFirewallEndpoint(UpdateFirewallEndpointRequest) returns (google.longrunning.Operation) { @@ -104,6 +150,20 @@ service FirewallActivation { }; } + // Update a single project Endpoint. + rpc UpdateProjectFirewallEndpoint(UpdateFirewallEndpointRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{firewall_endpoint.name=projects/*/locations/*/firewallEndpoints/*}" + body: "firewall_endpoint" + }; + option (google.api.method_signature) = "firewall_endpoint,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "FirewallEndpoint" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + // Lists Associations in a given project and location. rpc ListFirewallEndpointAssociations(ListFirewallEndpointAssociationsRequest) returns (ListFirewallEndpointAssociationsResponse) { @@ -258,10 +318,10 @@ message FirewallEndpoint { // https://google.aip.dev/128. bool reconciling = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. List of networks that are associated with this endpoint in the - // local zone. This is a projection of the FirewallEndpointAssociations - // pointing at this endpoint. A network will only appear in this list after - // traffic routing is fully configured. Format: + // Output only. Deprecated: List of networks that are associated with this + // endpoint in the local zone. This is a projection of the + // FirewallEndpointAssociations pointing at this endpoint. A network will only + // appear in this list after traffic routing is fully configured. Format: // projects/{project}/global/networks/{name}. repeated string associated_networks = 7 [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/security_profile_group_service.proto b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/security_profile_group_service.proto index 3ed94a755183..4790fca39e8a 100644 --- a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/security_profile_group_service.proto +++ b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/security_profile_group_service.proto @@ -34,6 +34,133 @@ option java_package = "com.google.cloud.networksecurity.v1"; option php_namespace = "Google\\Cloud\\NetworkSecurity\\V1"; option ruby_package = "Google::Cloud::NetworkSecurity::V1"; +// SecurityProfileGroup is a resource that defines an action for specific threat +// signatures or severity levels. +service SecurityProfileGroupService { + option (google.api.default_host) = "networksecurity.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists SecurityProfileGroups in a given project and location. + rpc ListSecurityProfileGroups(ListSecurityProfileGroupsRequest) + returns (ListSecurityProfileGroupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/securityProfileGroups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single SecurityProfileGroup. + rpc GetSecurityProfileGroup(GetSecurityProfileGroupRequest) + returns (SecurityProfileGroup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/securityProfileGroups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new SecurityProfileGroup in a given project and location. + rpc CreateSecurityProfileGroup(CreateSecurityProfileGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/securityProfileGroups" + body: "security_profile_group" + }; + option (google.api.method_signature) = + "parent,security_profile_group,security_profile_group_id"; + option (google.longrunning.operation_info) = { + response_type: "SecurityProfileGroup" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Updates the parameters of a single SecurityProfileGroup. + rpc UpdateSecurityProfileGroup(UpdateSecurityProfileGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{security_profile_group.name=projects/*/locations/*/securityProfileGroups/*}" + body: "security_profile_group" + }; + option (google.api.method_signature) = "security_profile_group,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "SecurityProfileGroup" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Deletes a single SecurityProfileGroup. + rpc DeleteSecurityProfileGroup(DeleteSecurityProfileGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/securityProfileGroups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Lists SecurityProfiles in a given project and location. + rpc ListSecurityProfiles(ListSecurityProfilesRequest) + returns (ListSecurityProfilesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/securityProfiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single SecurityProfile. + rpc GetSecurityProfile(GetSecurityProfileRequest) returns (SecurityProfile) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/securityProfiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new SecurityProfile in a given project and location. + rpc CreateSecurityProfile(CreateSecurityProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/securityProfiles" + body: "security_profile" + }; + option (google.api.method_signature) = + "parent,security_profile,security_profile_id"; + option (google.longrunning.operation_info) = { + response_type: "SecurityProfile" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Updates the parameters of a single SecurityProfile. + rpc UpdateSecurityProfile(UpdateSecurityProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{security_profile.name=projects/*/locations/*/securityProfiles/*}" + body: "security_profile" + }; + option (google.api.method_signature) = "security_profile,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "SecurityProfile" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Deletes a single SecurityProfile. + rpc DeleteSecurityProfile(DeleteSecurityProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/securityProfiles/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } +} + // Organization SecurityProfileGroup is created under organization. service OrganizationSecurityProfileGroupService { option (google.api.default_host) = "networksecurity.googleapis.com"; diff --git a/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/sse_realm.proto b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/sse_realm.proto new file mode 100644 index 000000000000..adffb004c35c --- /dev/null +++ b/packages/google-cloud-networksecurity/protos/google/cloud/networksecurity/v1/sse_realm.proto @@ -0,0 +1,507 @@ +// Copyright 2026 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.networksecurity.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; +import "google/api/resource.proto"; +import "google/cloud/networksecurity/v1/common.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkSecurity.V1"; +option go_package = "cloud.google.com/go/networksecurity/apiv1/networksecuritypb;networksecuritypb"; +option java_multiple_files = true; +option java_outer_classname = "SSERealmProto"; +option java_package = "com.google.cloud.networksecurity.v1"; +option php_namespace = "Google\\Cloud\\NetworkSecurity\\V1"; +option ruby_package = "Google::Cloud::NetworkSecurity::V1"; + +// Service describing handlers for resources +service SSERealmService { + option (google.api.default_host) = "networksecurity.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists SACRealms in a given project. + rpc ListSACRealms(ListSACRealmsRequest) returns (ListSACRealmsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/sacRealms" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the specified realm. + rpc GetSACRealm(GetSACRealmRequest) returns (SACRealm) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sacRealms/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new SACRealm in a given project. + rpc CreateSACRealm(CreateSACRealmRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/sacRealms" + body: "sac_realm" + }; + option (google.api.method_signature) = "parent,sac_realm,sac_realm_id"; + option (google.longrunning.operation_info) = { + response_type: "SACRealm" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Deletes the specified realm. + rpc DeleteSACRealm(DeleteSACRealmRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/sacRealms/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Lists SACAttachments in a given project and location. + rpc ListSACAttachments(ListSACAttachmentsRequest) + returns (ListSACAttachmentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/sacAttachments" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the specified attachment. + rpc GetSACAttachment(GetSACAttachmentRequest) returns (SACAttachment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/sacAttachments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new SACAttachment in a given project and location. + rpc CreateSACAttachment(CreateSACAttachmentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/sacAttachments" + body: "sac_attachment" + }; + option (google.api.method_signature) = + "parent,sac_attachment,sac_attachment_id"; + option (google.longrunning.operation_info) = { + response_type: "SACAttachment" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } + + // Deletes the specified attachment. + rpc DeleteSACAttachment(DeleteSACAttachmentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/sacAttachments/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networksecurity.v1.OperationMetadata" + }; + } +} + +// Represents a Secure Access Connect (SAC) realm resource. +// +// A Secure Access Connect realm establishes a connection between your Google +// Cloud project and an SSE service. +message SACRealm { + option (google.api.resource) = { + type: "networksecurity.googleapis.com/SACRealm" + pattern: "projects/{project}/locations/{location}/sacRealms/{sac_realm}" + plural: "sacRealms" + singular: "sacRealm" + }; + + // Key to be shared with SSE service provider to establish global handshake. + message PairingKey { + // Output only. Key value. + string key = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp in UTC of when this resource is considered + // expired. It expires 7 days after creation. + google.protobuf.Timestamp expire_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // SSE service provider + enum SecurityService { + // The default value. This value is used if the state is omitted. + SECURITY_SERVICE_UNSPECIFIED = 0; + + // [Palo Alto Networks Prisma + // Access](https://www.paloaltonetworks.com/sase/access). + PALO_ALTO_PRISMA_ACCESS = 1; + } + + // State of the realm. + enum State { + // No state specified. This should not be used. + STATE_UNSPECIFIED = 0; + + // Has never been attached to a partner. + // Used only for Prisma Access. + PENDING_PARTNER_ATTACHMENT = 7; + + // Currently attached to a partner. + PARTNER_ATTACHED = 1; + + // Was once attached to a partner but has been detached. + PARTNER_DETACHED = 2; + + // Is not attached to a partner and has an expired pairing key. + // Used only for Prisma Access. + KEY_EXPIRED = 3; + } + + // Identifier. Resource name, in the form + // `projects/{project}/locations/global/sacRealms/{sacRealm}`. + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. Timestamp when the realm was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when the realm was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Optional list of labels applied to the resource. + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Immutable. SSE service provider associated with the realm. + SecurityService security_service = 5 + [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Key to be shared with SSE service provider during pairing. + PairingKey pairing_key = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the realm. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for `ListSACRealms` method. +message ListSACRealmsRequest { + // Required. The parent, in the form `projects/{project}/locations/global`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networksecurity.googleapis.com/SACRealm" + } + ]; + + // Optional. Requested page size. Server may return fewer items than + // requested. If unspecified, server will pick an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An expression that filters the list of results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Sort the results by a certain order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for `ListSACRealms` method. +message ListSACRealmsResponse { + // The list of SACRealms. + repeated SACRealm sac_realms = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for `GetSACRealm` method. +message GetSACRealmRequest { + // Required. Name of the resource, in the form + // `projects/{project}/locations/global/sacRealms/{sacRealm}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networksecurity.googleapis.com/SACRealm" + } + ]; +} + +// Request for `CreateSACRealm` method. +message CreateSACRealmRequest { + // Required. The parent, in the form `projects/{project}/locations/global`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networksecurity.googleapis.com/SACRealm" + } + ]; + + // Required. ID of the created realm. + // The ID must be 1-63 characters long, and comply with + // RFC1035. + // Specifically, it must be 1-63 characters long and match the regular + // expression `[a-z]([-a-z0-9]*[a-z0-9])?` + // which means the first character must be a lowercase letter, and all + // following characters must be a dash, lowercase letter, or digit, except + // the last character, which cannot be a dash. + string sac_realm_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being created. + SACRealm sac_realm = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// Request for `DeleteSACRealm` method. +message DeleteSACRealmRequest { + // Required. Name of the resource, in the form + // `projects/{project}/locations/global/sacRealms/{sacRealm}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networksecurity.googleapis.com/SACRealm" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// Represents a Secure Access Connect (SAC) attachment resource. +// +// A Secure Access Connect attachment enables NCC Gateway to process traffic +// with an SSE product. +message SACAttachment { + option (google.api.resource) = { + type: "networksecurity.googleapis.com/SACAttachment" + pattern: "projects/{project}/locations/{location}/sacAttachments/{sac_attachment}" + plural: "sacAttachments" + singular: "sacAttachment" + }; + + // State of the attachment. + enum State { + // No state specified. This should not be used. + STATE_UNSPECIFIED = 0; + + // Has never been attached to a partner. + PENDING_PARTNER_ATTACHMENT = 1; + + // Currently attached to a partner. + PARTNER_ATTACHED = 2; + + // Was once attached to a partner but has been detached. + PARTNER_DETACHED = 3; + } + + // Identifier. Resource name, in the form + // `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. Timestamp when the attachment was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp when the attachment was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Optional list of labels applied to the resource. + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. SAC Realm which owns the attachment. This can be input as an ID + // or a full resource name. The output always has the form + // `projects/{project_number}/locations/{location}/sacRealms/{sac_realm}`. + string sac_realm = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. NCC Gateway associated with the attachment. This can be input as + // an ID or a full resource name. The output always has the form + // `projects/{project_number}/locations/{location}/spokes/{ncc_gateway}`. + string ncc_gateway = 6 [(google.api.field_behavior) = REQUIRED]; + + // Output only. State of the attachment. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for `ListSACAttachments` method. +message ListSACAttachmentsRequest { + // Required. The parent, in the form + // `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networksecurity.googleapis.com/SACAttachment" + } + ]; + + // Optional. Requested page size. Server may return fewer items than + // requested. If unspecified, server will pick an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An expression that filters the list of results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Sort the results by a certain order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for `ListSACAttachments` method. +message ListSACAttachmentsResponse { + // The list of SACAttachments. + repeated SACAttachment sac_attachments = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for `GetSACAttachment` method. +message GetSACAttachmentRequest { + // Required. Name of the resource, in the form + // `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networksecurity.googleapis.com/SACAttachment" + } + ]; +} + +// Request for `CreateSACAttachment` method. +message CreateSACAttachmentRequest { + // Required. The parent, in the form + // `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networksecurity.googleapis.com/SACAttachment" + } + ]; + + // Required. ID of the created attachment. + // The ID must be 1-63 characters long, and comply with + // RFC1035. + // Specifically, it must be 1-63 characters long and match the regular + // expression `[a-z]([-a-z0-9]*[a-z0-9])?` + // which means the first character must be a lowercase letter, and all + // following characters must be a dash, lowercase letter, or digit, except + // the last character, which cannot be a dash. + string sac_attachment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The resource being created. + SACAttachment sac_attachment = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// Request for `DeleteSACAttachment` method. +message DeleteSACAttachmentRequest { + // Required. Name of the resource, in the form + // `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networksecurity.googleapis.com/SACAttachment" + } + ]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} diff --git a/packages/google-cloud-networksecurity/protos/protos.d.ts b/packages/google-cloud-networksecurity/protos/protos.d.ts index 00adf3f790a6..11d90e87a60c 100644 --- a/packages/google-cloud-networksecurity/protos/protos.d.ts +++ b/packages/google-cloud-networksecurity/protos/protos.d.ts @@ -3270,6 +3270,9 @@ export namespace google { /** AuthzPolicy httpRules */ httpRules?: (google.cloud.networksecurity.v1.AuthzPolicy.IAuthzRule[]|null); + /** AuthzPolicy networkRules */ + networkRules?: (google.cloud.networksecurity.v1.AuthzPolicy.IAuthzRule[]|null); + /** AuthzPolicy action */ action?: (google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction|keyof typeof google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction|null); @@ -3310,6 +3313,9 @@ export namespace google { /** AuthzPolicy httpRules. */ public httpRules: google.cloud.networksecurity.v1.AuthzPolicy.IAuthzRule[]; + /** AuthzPolicy networkRules. */ + public networkRules: google.cloud.networksecurity.v1.AuthzPolicy.IAuthzRule[]; + /** AuthzPolicy action. */ public action: (google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction|keyof typeof google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction); @@ -4597,6 +4603,9 @@ export namespace google { /** RequestOperation mcp */ mcp?: (google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.IMCP|null); + + /** RequestOperation snis */ + snis?: (google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.IStringMatch[]|null); } /** Represents a RequestOperation. */ @@ -4623,6 +4632,9 @@ export namespace google { /** RequestOperation mcp. */ public mcp?: (google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.IMCP|null); + /** RequestOperation snis. */ + public snis: google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.IStringMatch[]; + /** * Creates a new RequestOperation instance using the specified properties. * @param [properties] Properties to set @@ -8859,6 +8871,20 @@ export namespace google { */ public listFirewallEndpoints(request: google.cloud.networksecurity.v1.IListFirewallEndpointsRequest): Promise; + /** + * Calls ListProjectFirewallEndpoints. + * @param request ListFirewallEndpointsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFirewallEndpointsResponse + */ + public listProjectFirewallEndpoints(request: google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, callback: google.cloud.networksecurity.v1.FirewallActivation.ListProjectFirewallEndpointsCallback): void; + + /** + * Calls ListProjectFirewallEndpoints. + * @param request ListFirewallEndpointsRequest message or plain object + * @returns Promise + */ + public listProjectFirewallEndpoints(request: google.cloud.networksecurity.v1.IListFirewallEndpointsRequest): Promise; + /** * Calls GetFirewallEndpoint. * @param request GetFirewallEndpointRequest message or plain object @@ -8873,6 +8899,20 @@ export namespace google { */ public getFirewallEndpoint(request: google.cloud.networksecurity.v1.IGetFirewallEndpointRequest): Promise; + /** + * Calls GetProjectFirewallEndpoint. + * @param request GetFirewallEndpointRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FirewallEndpoint + */ + public getProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, callback: google.cloud.networksecurity.v1.FirewallActivation.GetProjectFirewallEndpointCallback): void; + + /** + * Calls GetProjectFirewallEndpoint. + * @param request GetFirewallEndpointRequest message or plain object + * @returns Promise + */ + public getProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IGetFirewallEndpointRequest): Promise; + /** * Calls CreateFirewallEndpoint. * @param request CreateFirewallEndpointRequest message or plain object @@ -8887,6 +8927,20 @@ export namespace google { */ public createFirewallEndpoint(request: google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest): Promise; + /** + * Calls CreateProjectFirewallEndpoint. + * @param request CreateFirewallEndpointRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, callback: google.cloud.networksecurity.v1.FirewallActivation.CreateProjectFirewallEndpointCallback): void; + + /** + * Calls CreateProjectFirewallEndpoint. + * @param request CreateFirewallEndpointRequest message or plain object + * @returns Promise + */ + public createProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest): Promise; + /** * Calls DeleteFirewallEndpoint. * @param request DeleteFirewallEndpointRequest message or plain object @@ -8901,6 +8955,20 @@ export namespace google { */ public deleteFirewallEndpoint(request: google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest): Promise; + /** + * Calls DeleteProjectFirewallEndpoint. + * @param request DeleteFirewallEndpointRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, callback: google.cloud.networksecurity.v1.FirewallActivation.DeleteProjectFirewallEndpointCallback): void; + + /** + * Calls DeleteProjectFirewallEndpoint. + * @param request DeleteFirewallEndpointRequest message or plain object + * @returns Promise + */ + public deleteProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest): Promise; + /** * Calls UpdateFirewallEndpoint. * @param request UpdateFirewallEndpointRequest message or plain object @@ -8915,6 +8983,20 @@ export namespace google { */ public updateFirewallEndpoint(request: google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest): Promise; + /** + * Calls UpdateProjectFirewallEndpoint. + * @param request UpdateFirewallEndpointRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, callback: google.cloud.networksecurity.v1.FirewallActivation.UpdateProjectFirewallEndpointCallback): void; + + /** + * Calls UpdateProjectFirewallEndpoint. + * @param request UpdateFirewallEndpointRequest message or plain object + * @returns Promise + */ + public updateProjectFirewallEndpoint(request: google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest): Promise; + /** * Calls ListFirewallEndpointAssociations. * @param request ListFirewallEndpointAssociationsRequest message or plain object @@ -8995,6 +9077,13 @@ export namespace google { */ type ListFirewallEndpointsCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListFirewallEndpointsResponse) => void; + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|listProjectFirewallEndpoints}. + * @param error Error, if any + * @param [response] ListFirewallEndpointsResponse + */ + type ListProjectFirewallEndpointsCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListFirewallEndpointsResponse) => void; + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|getFirewallEndpoint}. * @param error Error, if any @@ -9002,6 +9091,13 @@ export namespace google { */ type GetFirewallEndpointCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.FirewallEndpoint) => void; + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|getProjectFirewallEndpoint}. + * @param error Error, if any + * @param [response] FirewallEndpoint + */ + type GetProjectFirewallEndpointCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.FirewallEndpoint) => void; + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|createFirewallEndpoint}. * @param error Error, if any @@ -9009,6 +9105,13 @@ export namespace google { */ type CreateFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|createProjectFirewallEndpoint}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateProjectFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|deleteFirewallEndpoint}. * @param error Error, if any @@ -9016,6 +9119,13 @@ export namespace google { */ type DeleteFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|deleteProjectFirewallEndpoint}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProjectFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|updateFirewallEndpoint}. * @param error Error, if any @@ -9023,6 +9133,13 @@ export namespace google { */ type UpdateFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|updateProjectFirewallEndpoint}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateProjectFirewallEndpointCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|listFirewallEndpointAssociations}. * @param error Error, if any @@ -25747,6 +25864,240 @@ export namespace google { } } + /** Represents a SecurityProfileGroupService */ + class SecurityProfileGroupService extends $protobuf.rpc.Service { + + /** + * Constructs a new SecurityProfileGroupService 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 SecurityProfileGroupService 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): SecurityProfileGroupService; + + /** + * Calls ListSecurityProfileGroups. + * @param request ListSecurityProfileGroupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSecurityProfileGroupsResponse + */ + public listSecurityProfileGroups(request: google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfileGroupsCallback): void; + + /** + * Calls ListSecurityProfileGroups. + * @param request ListSecurityProfileGroupsRequest message or plain object + * @returns Promise + */ + public listSecurityProfileGroups(request: google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest): Promise; + + /** + * Calls GetSecurityProfileGroup. + * @param request GetSecurityProfileGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SecurityProfileGroup + */ + public getSecurityProfileGroup(request: google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileGroupCallback): void; + + /** + * Calls GetSecurityProfileGroup. + * @param request GetSecurityProfileGroupRequest message or plain object + * @returns Promise + */ + public getSecurityProfileGroup(request: google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest): Promise; + + /** + * Calls CreateSecurityProfileGroup. + * @param request CreateSecurityProfileGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createSecurityProfileGroup(request: google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileGroupCallback): void; + + /** + * Calls CreateSecurityProfileGroup. + * @param request CreateSecurityProfileGroupRequest message or plain object + * @returns Promise + */ + public createSecurityProfileGroup(request: google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest): Promise; + + /** + * Calls UpdateSecurityProfileGroup. + * @param request UpdateSecurityProfileGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateSecurityProfileGroup(request: google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileGroupCallback): void; + + /** + * Calls UpdateSecurityProfileGroup. + * @param request UpdateSecurityProfileGroupRequest message or plain object + * @returns Promise + */ + public updateSecurityProfileGroup(request: google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest): Promise; + + /** + * Calls DeleteSecurityProfileGroup. + * @param request DeleteSecurityProfileGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteSecurityProfileGroup(request: google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileGroupCallback): void; + + /** + * Calls DeleteSecurityProfileGroup. + * @param request DeleteSecurityProfileGroupRequest message or plain object + * @returns Promise + */ + public deleteSecurityProfileGroup(request: google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest): Promise; + + /** + * Calls ListSecurityProfiles. + * @param request ListSecurityProfilesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSecurityProfilesResponse + */ + public listSecurityProfiles(request: google.cloud.networksecurity.v1.IListSecurityProfilesRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfilesCallback): void; + + /** + * Calls ListSecurityProfiles. + * @param request ListSecurityProfilesRequest message or plain object + * @returns Promise + */ + public listSecurityProfiles(request: google.cloud.networksecurity.v1.IListSecurityProfilesRequest): Promise; + + /** + * Calls GetSecurityProfile. + * @param request GetSecurityProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SecurityProfile + */ + public getSecurityProfile(request: google.cloud.networksecurity.v1.IGetSecurityProfileRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileCallback): void; + + /** + * Calls GetSecurityProfile. + * @param request GetSecurityProfileRequest message or plain object + * @returns Promise + */ + public getSecurityProfile(request: google.cloud.networksecurity.v1.IGetSecurityProfileRequest): Promise; + + /** + * Calls CreateSecurityProfile. + * @param request CreateSecurityProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createSecurityProfile(request: google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileCallback): void; + + /** + * Calls CreateSecurityProfile. + * @param request CreateSecurityProfileRequest message or plain object + * @returns Promise + */ + public createSecurityProfile(request: google.cloud.networksecurity.v1.ICreateSecurityProfileRequest): Promise; + + /** + * Calls UpdateSecurityProfile. + * @param request UpdateSecurityProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateSecurityProfile(request: google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileCallback): void; + + /** + * Calls UpdateSecurityProfile. + * @param request UpdateSecurityProfileRequest message or plain object + * @returns Promise + */ + public updateSecurityProfile(request: google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest): Promise; + + /** + * Calls DeleteSecurityProfile. + * @param request DeleteSecurityProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteSecurityProfile(request: google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, callback: google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileCallback): void; + + /** + * Calls DeleteSecurityProfile. + * @param request DeleteSecurityProfileRequest message or plain object + * @returns Promise + */ + public deleteSecurityProfile(request: google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest): Promise; + } + + namespace SecurityProfileGroupService { + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|listSecurityProfileGroups}. + * @param error Error, if any + * @param [response] ListSecurityProfileGroupsResponse + */ + type ListSecurityProfileGroupsCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListSecurityProfileGroupsResponse) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|getSecurityProfileGroup}. + * @param error Error, if any + * @param [response] SecurityProfileGroup + */ + type GetSecurityProfileGroupCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.SecurityProfileGroup) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|createSecurityProfileGroup}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateSecurityProfileGroupCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|updateSecurityProfileGroup}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateSecurityProfileGroupCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|deleteSecurityProfileGroup}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteSecurityProfileGroupCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|listSecurityProfiles}. + * @param error Error, if any + * @param [response] ListSecurityProfilesResponse + */ + type ListSecurityProfilesCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListSecurityProfilesResponse) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|getSecurityProfile}. + * @param error Error, if any + * @param [response] SecurityProfile + */ + type GetSecurityProfileCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.SecurityProfile) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|createSecurityProfile}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateSecurityProfileCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|updateSecurityProfile}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateSecurityProfileCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|deleteSecurityProfile}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteSecurityProfileCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + /** Represents an OrganizationSecurityProfileGroupService */ class OrganizationSecurityProfileGroupService extends $protobuf.rpc.Service { @@ -27228,6 +27579,1686 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Represents a SSERealmService */ + class SSERealmService extends $protobuf.rpc.Service { + + /** + * Constructs a new SSERealmService 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 SSERealmService 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): SSERealmService; + + /** + * Calls ListSACRealms. + * @param request ListSACRealmsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSACRealmsResponse + */ + public listSACRealms(request: google.cloud.networksecurity.v1.IListSACRealmsRequest, callback: google.cloud.networksecurity.v1.SSERealmService.ListSACRealmsCallback): void; + + /** + * Calls ListSACRealms. + * @param request ListSACRealmsRequest message or plain object + * @returns Promise + */ + public listSACRealms(request: google.cloud.networksecurity.v1.IListSACRealmsRequest): Promise; + + /** + * Calls GetSACRealm. + * @param request GetSACRealmRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SACRealm + */ + public getSACRealm(request: google.cloud.networksecurity.v1.IGetSACRealmRequest, callback: google.cloud.networksecurity.v1.SSERealmService.GetSACRealmCallback): void; + + /** + * Calls GetSACRealm. + * @param request GetSACRealmRequest message or plain object + * @returns Promise + */ + public getSACRealm(request: google.cloud.networksecurity.v1.IGetSACRealmRequest): Promise; + + /** + * Calls CreateSACRealm. + * @param request CreateSACRealmRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createSACRealm(request: google.cloud.networksecurity.v1.ICreateSACRealmRequest, callback: google.cloud.networksecurity.v1.SSERealmService.CreateSACRealmCallback): void; + + /** + * Calls CreateSACRealm. + * @param request CreateSACRealmRequest message or plain object + * @returns Promise + */ + public createSACRealm(request: google.cloud.networksecurity.v1.ICreateSACRealmRequest): Promise; + + /** + * Calls DeleteSACRealm. + * @param request DeleteSACRealmRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteSACRealm(request: google.cloud.networksecurity.v1.IDeleteSACRealmRequest, callback: google.cloud.networksecurity.v1.SSERealmService.DeleteSACRealmCallback): void; + + /** + * Calls DeleteSACRealm. + * @param request DeleteSACRealmRequest message or plain object + * @returns Promise + */ + public deleteSACRealm(request: google.cloud.networksecurity.v1.IDeleteSACRealmRequest): Promise; + + /** + * Calls ListSACAttachments. + * @param request ListSACAttachmentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSACAttachmentsResponse + */ + public listSACAttachments(request: google.cloud.networksecurity.v1.IListSACAttachmentsRequest, callback: google.cloud.networksecurity.v1.SSERealmService.ListSACAttachmentsCallback): void; + + /** + * Calls ListSACAttachments. + * @param request ListSACAttachmentsRequest message or plain object + * @returns Promise + */ + public listSACAttachments(request: google.cloud.networksecurity.v1.IListSACAttachmentsRequest): Promise; + + /** + * Calls GetSACAttachment. + * @param request GetSACAttachmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SACAttachment + */ + public getSACAttachment(request: google.cloud.networksecurity.v1.IGetSACAttachmentRequest, callback: google.cloud.networksecurity.v1.SSERealmService.GetSACAttachmentCallback): void; + + /** + * Calls GetSACAttachment. + * @param request GetSACAttachmentRequest message or plain object + * @returns Promise + */ + public getSACAttachment(request: google.cloud.networksecurity.v1.IGetSACAttachmentRequest): Promise; + + /** + * Calls CreateSACAttachment. + * @param request CreateSACAttachmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createSACAttachment(request: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, callback: google.cloud.networksecurity.v1.SSERealmService.CreateSACAttachmentCallback): void; + + /** + * Calls CreateSACAttachment. + * @param request CreateSACAttachmentRequest message or plain object + * @returns Promise + */ + public createSACAttachment(request: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest): Promise; + + /** + * Calls DeleteSACAttachment. + * @param request DeleteSACAttachmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteSACAttachment(request: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, callback: google.cloud.networksecurity.v1.SSERealmService.DeleteSACAttachmentCallback): void; + + /** + * Calls DeleteSACAttachment. + * @param request DeleteSACAttachmentRequest message or plain object + * @returns Promise + */ + public deleteSACAttachment(request: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest): Promise; + } + + namespace SSERealmService { + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|listSACRealms}. + * @param error Error, if any + * @param [response] ListSACRealmsResponse + */ + type ListSACRealmsCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListSACRealmsResponse) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|getSACRealm}. + * @param error Error, if any + * @param [response] SACRealm + */ + type GetSACRealmCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.SACRealm) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|createSACRealm}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateSACRealmCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|deleteSACRealm}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteSACRealmCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|listSACAttachments}. + * @param error Error, if any + * @param [response] ListSACAttachmentsResponse + */ + type ListSACAttachmentsCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.ListSACAttachmentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|getSACAttachment}. + * @param error Error, if any + * @param [response] SACAttachment + */ + type GetSACAttachmentCallback = (error: (Error|null), response?: google.cloud.networksecurity.v1.SACAttachment) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|createSACAttachment}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateSACAttachmentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|deleteSACAttachment}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteSACAttachmentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a SACRealm. */ + interface ISACRealm { + + /** SACRealm name */ + name?: (string|null); + + /** SACRealm createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** SACRealm updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** SACRealm labels */ + labels?: ({ [k: string]: string }|null); + + /** SACRealm securityService */ + securityService?: (google.cloud.networksecurity.v1.SACRealm.SecurityService|keyof typeof google.cloud.networksecurity.v1.SACRealm.SecurityService|null); + + /** SACRealm pairingKey */ + pairingKey?: (google.cloud.networksecurity.v1.SACRealm.IPairingKey|null); + + /** SACRealm state */ + state?: (google.cloud.networksecurity.v1.SACRealm.State|keyof typeof google.cloud.networksecurity.v1.SACRealm.State|null); + } + + /** Represents a SACRealm. */ + class SACRealm implements ISACRealm { + + /** + * Constructs a new SACRealm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.ISACRealm); + + /** SACRealm name. */ + public name: string; + + /** SACRealm createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** SACRealm updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** SACRealm labels. */ + public labels: { [k: string]: string }; + + /** SACRealm securityService. */ + public securityService: (google.cloud.networksecurity.v1.SACRealm.SecurityService|keyof typeof google.cloud.networksecurity.v1.SACRealm.SecurityService); + + /** SACRealm pairingKey. */ + public pairingKey?: (google.cloud.networksecurity.v1.SACRealm.IPairingKey|null); + + /** SACRealm state. */ + public state: (google.cloud.networksecurity.v1.SACRealm.State|keyof typeof google.cloud.networksecurity.v1.SACRealm.State); + + /** + * Creates a new SACRealm instance using the specified properties. + * @param [properties] Properties to set + * @returns SACRealm instance + */ + public static create(properties?: google.cloud.networksecurity.v1.ISACRealm): google.cloud.networksecurity.v1.SACRealm; + + /** + * Encodes the specified SACRealm message. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.verify|verify} messages. + * @param message SACRealm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.ISACRealm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SACRealm message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.verify|verify} messages. + * @param message SACRealm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.ISACRealm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SACRealm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SACRealm + * @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.networksecurity.v1.SACRealm; + + /** + * Decodes a SACRealm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SACRealm + * @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.networksecurity.v1.SACRealm; + + /** + * Verifies a SACRealm 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 SACRealm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SACRealm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.SACRealm; + + /** + * Creates a plain object from a SACRealm message. Also converts values to other types if specified. + * @param message SACRealm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.SACRealm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SACRealm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SACRealm + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SACRealm { + + /** Properties of a PairingKey. */ + interface IPairingKey { + + /** PairingKey key */ + key?: (string|null); + + /** PairingKey expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a PairingKey. */ + class PairingKey implements IPairingKey { + + /** + * Constructs a new PairingKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.SACRealm.IPairingKey); + + /** PairingKey key. */ + public key: string; + + /** PairingKey expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new PairingKey instance using the specified properties. + * @param [properties] Properties to set + * @returns PairingKey instance + */ + public static create(properties?: google.cloud.networksecurity.v1.SACRealm.IPairingKey): google.cloud.networksecurity.v1.SACRealm.PairingKey; + + /** + * Encodes the specified PairingKey message. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.PairingKey.verify|verify} messages. + * @param message PairingKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.SACRealm.IPairingKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PairingKey message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.PairingKey.verify|verify} messages. + * @param message PairingKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.SACRealm.IPairingKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PairingKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PairingKey + * @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.networksecurity.v1.SACRealm.PairingKey; + + /** + * Decodes a PairingKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PairingKey + * @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.networksecurity.v1.SACRealm.PairingKey; + + /** + * Verifies a PairingKey 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 PairingKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PairingKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.SACRealm.PairingKey; + + /** + * Creates a plain object from a PairingKey message. Also converts values to other types if specified. + * @param message PairingKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.SACRealm.PairingKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PairingKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PairingKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SecurityService enum. */ + enum SecurityService { + SECURITY_SERVICE_UNSPECIFIED = 0, + PALO_ALTO_PRISMA_ACCESS = 1 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING_PARTNER_ATTACHMENT = 7, + PARTNER_ATTACHED = 1, + PARTNER_DETACHED = 2, + KEY_EXPIRED = 3 + } + } + + /** Properties of a ListSACRealmsRequest. */ + interface IListSACRealmsRequest { + + /** ListSACRealmsRequest parent */ + parent?: (string|null); + + /** ListSACRealmsRequest pageSize */ + pageSize?: (number|null); + + /** ListSACRealmsRequest pageToken */ + pageToken?: (string|null); + + /** ListSACRealmsRequest filter */ + filter?: (string|null); + + /** ListSACRealmsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListSACRealmsRequest. */ + class ListSACRealmsRequest implements IListSACRealmsRequest { + + /** + * Constructs a new ListSACRealmsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IListSACRealmsRequest); + + /** ListSACRealmsRequest parent. */ + public parent: string; + + /** ListSACRealmsRequest pageSize. */ + public pageSize: number; + + /** ListSACRealmsRequest pageToken. */ + public pageToken: string; + + /** ListSACRealmsRequest filter. */ + public filter: string; + + /** ListSACRealmsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListSACRealmsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSACRealmsRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IListSACRealmsRequest): google.cloud.networksecurity.v1.ListSACRealmsRequest; + + /** + * Encodes the specified ListSACRealmsRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsRequest.verify|verify} messages. + * @param message ListSACRealmsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IListSACRealmsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSACRealmsRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsRequest.verify|verify} messages. + * @param message ListSACRealmsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IListSACRealmsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSACRealmsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSACRealmsRequest + * @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.networksecurity.v1.ListSACRealmsRequest; + + /** + * Decodes a ListSACRealmsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSACRealmsRequest + * @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.networksecurity.v1.ListSACRealmsRequest; + + /** + * Verifies a ListSACRealmsRequest 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 ListSACRealmsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSACRealmsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.ListSACRealmsRequest; + + /** + * Creates a plain object from a ListSACRealmsRequest message. Also converts values to other types if specified. + * @param message ListSACRealmsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.ListSACRealmsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSACRealmsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSACRealmsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSACRealmsResponse. */ + interface IListSACRealmsResponse { + + /** ListSACRealmsResponse sacRealms */ + sacRealms?: (google.cloud.networksecurity.v1.ISACRealm[]|null); + + /** ListSACRealmsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListSACRealmsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListSACRealmsResponse. */ + class ListSACRealmsResponse implements IListSACRealmsResponse { + + /** + * Constructs a new ListSACRealmsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IListSACRealmsResponse); + + /** ListSACRealmsResponse sacRealms. */ + public sacRealms: google.cloud.networksecurity.v1.ISACRealm[]; + + /** ListSACRealmsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListSACRealmsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListSACRealmsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSACRealmsResponse instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IListSACRealmsResponse): google.cloud.networksecurity.v1.ListSACRealmsResponse; + + /** + * Encodes the specified ListSACRealmsResponse message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsResponse.verify|verify} messages. + * @param message ListSACRealmsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IListSACRealmsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSACRealmsResponse message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsResponse.verify|verify} messages. + * @param message ListSACRealmsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IListSACRealmsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSACRealmsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSACRealmsResponse + * @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.networksecurity.v1.ListSACRealmsResponse; + + /** + * Decodes a ListSACRealmsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSACRealmsResponse + * @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.networksecurity.v1.ListSACRealmsResponse; + + /** + * Verifies a ListSACRealmsResponse 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 ListSACRealmsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSACRealmsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.ListSACRealmsResponse; + + /** + * Creates a plain object from a ListSACRealmsResponse message. Also converts values to other types if specified. + * @param message ListSACRealmsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.ListSACRealmsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSACRealmsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSACRealmsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSACRealmRequest. */ + interface IGetSACRealmRequest { + + /** GetSACRealmRequest name */ + name?: (string|null); + } + + /** Represents a GetSACRealmRequest. */ + class GetSACRealmRequest implements IGetSACRealmRequest { + + /** + * Constructs a new GetSACRealmRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IGetSACRealmRequest); + + /** GetSACRealmRequest name. */ + public name: string; + + /** + * Creates a new GetSACRealmRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSACRealmRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IGetSACRealmRequest): google.cloud.networksecurity.v1.GetSACRealmRequest; + + /** + * Encodes the specified GetSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACRealmRequest.verify|verify} messages. + * @param message GetSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IGetSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACRealmRequest.verify|verify} messages. + * @param message GetSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IGetSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSACRealmRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSACRealmRequest + * @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.networksecurity.v1.GetSACRealmRequest; + + /** + * Decodes a GetSACRealmRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSACRealmRequest + * @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.networksecurity.v1.GetSACRealmRequest; + + /** + * Verifies a GetSACRealmRequest 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 GetSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSACRealmRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.GetSACRealmRequest; + + /** + * Creates a plain object from a GetSACRealmRequest message. Also converts values to other types if specified. + * @param message GetSACRealmRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.GetSACRealmRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSACRealmRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSACRealmRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSACRealmRequest. */ + interface ICreateSACRealmRequest { + + /** CreateSACRealmRequest parent */ + parent?: (string|null); + + /** CreateSACRealmRequest sacRealmId */ + sacRealmId?: (string|null); + + /** CreateSACRealmRequest sacRealm */ + sacRealm?: (google.cloud.networksecurity.v1.ISACRealm|null); + + /** CreateSACRealmRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateSACRealmRequest. */ + class CreateSACRealmRequest implements ICreateSACRealmRequest { + + /** + * Constructs a new CreateSACRealmRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.ICreateSACRealmRequest); + + /** CreateSACRealmRequest parent. */ + public parent: string; + + /** CreateSACRealmRequest sacRealmId. */ + public sacRealmId: string; + + /** CreateSACRealmRequest sacRealm. */ + public sacRealm?: (google.cloud.networksecurity.v1.ISACRealm|null); + + /** CreateSACRealmRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateSACRealmRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSACRealmRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.ICreateSACRealmRequest): google.cloud.networksecurity.v1.CreateSACRealmRequest; + + /** + * Encodes the specified CreateSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACRealmRequest.verify|verify} messages. + * @param message CreateSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.ICreateSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACRealmRequest.verify|verify} messages. + * @param message CreateSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.ICreateSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSACRealmRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSACRealmRequest + * @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.networksecurity.v1.CreateSACRealmRequest; + + /** + * Decodes a CreateSACRealmRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSACRealmRequest + * @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.networksecurity.v1.CreateSACRealmRequest; + + /** + * Verifies a CreateSACRealmRequest 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 CreateSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSACRealmRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.CreateSACRealmRequest; + + /** + * Creates a plain object from a CreateSACRealmRequest message. Also converts values to other types if specified. + * @param message CreateSACRealmRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.CreateSACRealmRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSACRealmRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSACRealmRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSACRealmRequest. */ + interface IDeleteSACRealmRequest { + + /** DeleteSACRealmRequest name */ + name?: (string|null); + + /** DeleteSACRealmRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteSACRealmRequest. */ + class DeleteSACRealmRequest implements IDeleteSACRealmRequest { + + /** + * Constructs a new DeleteSACRealmRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IDeleteSACRealmRequest); + + /** DeleteSACRealmRequest name. */ + public name: string; + + /** DeleteSACRealmRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteSACRealmRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSACRealmRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IDeleteSACRealmRequest): google.cloud.networksecurity.v1.DeleteSACRealmRequest; + + /** + * Encodes the specified DeleteSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACRealmRequest.verify|verify} messages. + * @param message DeleteSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IDeleteSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACRealmRequest.verify|verify} messages. + * @param message DeleteSACRealmRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IDeleteSACRealmRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSACRealmRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSACRealmRequest + * @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.networksecurity.v1.DeleteSACRealmRequest; + + /** + * Decodes a DeleteSACRealmRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSACRealmRequest + * @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.networksecurity.v1.DeleteSACRealmRequest; + + /** + * Verifies a DeleteSACRealmRequest 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 DeleteSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSACRealmRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.DeleteSACRealmRequest; + + /** + * Creates a plain object from a DeleteSACRealmRequest message. Also converts values to other types if specified. + * @param message DeleteSACRealmRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.DeleteSACRealmRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSACRealmRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSACRealmRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SACAttachment. */ + interface ISACAttachment { + + /** SACAttachment name */ + name?: (string|null); + + /** SACAttachment createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** SACAttachment updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** SACAttachment labels */ + labels?: ({ [k: string]: string }|null); + + /** SACAttachment sacRealm */ + sacRealm?: (string|null); + + /** SACAttachment nccGateway */ + nccGateway?: (string|null); + + /** SACAttachment state */ + state?: (google.cloud.networksecurity.v1.SACAttachment.State|keyof typeof google.cloud.networksecurity.v1.SACAttachment.State|null); + } + + /** Represents a SACAttachment. */ + class SACAttachment implements ISACAttachment { + + /** + * Constructs a new SACAttachment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.ISACAttachment); + + /** SACAttachment name. */ + public name: string; + + /** SACAttachment createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** SACAttachment updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** SACAttachment labels. */ + public labels: { [k: string]: string }; + + /** SACAttachment sacRealm. */ + public sacRealm: string; + + /** SACAttachment nccGateway. */ + public nccGateway: string; + + /** SACAttachment state. */ + public state: (google.cloud.networksecurity.v1.SACAttachment.State|keyof typeof google.cloud.networksecurity.v1.SACAttachment.State); + + /** + * Creates a new SACAttachment instance using the specified properties. + * @param [properties] Properties to set + * @returns SACAttachment instance + */ + public static create(properties?: google.cloud.networksecurity.v1.ISACAttachment): google.cloud.networksecurity.v1.SACAttachment; + + /** + * Encodes the specified SACAttachment message. Does not implicitly {@link google.cloud.networksecurity.v1.SACAttachment.verify|verify} messages. + * @param message SACAttachment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.ISACAttachment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SACAttachment message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACAttachment.verify|verify} messages. + * @param message SACAttachment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.ISACAttachment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SACAttachment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SACAttachment + * @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.networksecurity.v1.SACAttachment; + + /** + * Decodes a SACAttachment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SACAttachment + * @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.networksecurity.v1.SACAttachment; + + /** + * Verifies a SACAttachment 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 SACAttachment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SACAttachment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.SACAttachment; + + /** + * Creates a plain object from a SACAttachment message. Also converts values to other types if specified. + * @param message SACAttachment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.SACAttachment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SACAttachment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SACAttachment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SACAttachment { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING_PARTNER_ATTACHMENT = 1, + PARTNER_ATTACHED = 2, + PARTNER_DETACHED = 3 + } + } + + /** Properties of a ListSACAttachmentsRequest. */ + interface IListSACAttachmentsRequest { + + /** ListSACAttachmentsRequest parent */ + parent?: (string|null); + + /** ListSACAttachmentsRequest pageSize */ + pageSize?: (number|null); + + /** ListSACAttachmentsRequest pageToken */ + pageToken?: (string|null); + + /** ListSACAttachmentsRequest filter */ + filter?: (string|null); + + /** ListSACAttachmentsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListSACAttachmentsRequest. */ + class ListSACAttachmentsRequest implements IListSACAttachmentsRequest { + + /** + * Constructs a new ListSACAttachmentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IListSACAttachmentsRequest); + + /** ListSACAttachmentsRequest parent. */ + public parent: string; + + /** ListSACAttachmentsRequest pageSize. */ + public pageSize: number; + + /** ListSACAttachmentsRequest pageToken. */ + public pageToken: string; + + /** ListSACAttachmentsRequest filter. */ + public filter: string; + + /** ListSACAttachmentsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListSACAttachmentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSACAttachmentsRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IListSACAttachmentsRequest): google.cloud.networksecurity.v1.ListSACAttachmentsRequest; + + /** + * Encodes the specified ListSACAttachmentsRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsRequest.verify|verify} messages. + * @param message ListSACAttachmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IListSACAttachmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSACAttachmentsRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsRequest.verify|verify} messages. + * @param message ListSACAttachmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IListSACAttachmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSACAttachmentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSACAttachmentsRequest + * @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.networksecurity.v1.ListSACAttachmentsRequest; + + /** + * Decodes a ListSACAttachmentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSACAttachmentsRequest + * @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.networksecurity.v1.ListSACAttachmentsRequest; + + /** + * Verifies a ListSACAttachmentsRequest 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 ListSACAttachmentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSACAttachmentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.ListSACAttachmentsRequest; + + /** + * Creates a plain object from a ListSACAttachmentsRequest message. Also converts values to other types if specified. + * @param message ListSACAttachmentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.ListSACAttachmentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSACAttachmentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSACAttachmentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSACAttachmentsResponse. */ + interface IListSACAttachmentsResponse { + + /** ListSACAttachmentsResponse sacAttachments */ + sacAttachments?: (google.cloud.networksecurity.v1.ISACAttachment[]|null); + + /** ListSACAttachmentsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListSACAttachmentsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListSACAttachmentsResponse. */ + class ListSACAttachmentsResponse implements IListSACAttachmentsResponse { + + /** + * Constructs a new ListSACAttachmentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IListSACAttachmentsResponse); + + /** ListSACAttachmentsResponse sacAttachments. */ + public sacAttachments: google.cloud.networksecurity.v1.ISACAttachment[]; + + /** ListSACAttachmentsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListSACAttachmentsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListSACAttachmentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSACAttachmentsResponse instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IListSACAttachmentsResponse): google.cloud.networksecurity.v1.ListSACAttachmentsResponse; + + /** + * Encodes the specified ListSACAttachmentsResponse message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsResponse.verify|verify} messages. + * @param message ListSACAttachmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IListSACAttachmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSACAttachmentsResponse message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsResponse.verify|verify} messages. + * @param message ListSACAttachmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IListSACAttachmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSACAttachmentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSACAttachmentsResponse + * @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.networksecurity.v1.ListSACAttachmentsResponse; + + /** + * Decodes a ListSACAttachmentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSACAttachmentsResponse + * @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.networksecurity.v1.ListSACAttachmentsResponse; + + /** + * Verifies a ListSACAttachmentsResponse 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 ListSACAttachmentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSACAttachmentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.ListSACAttachmentsResponse; + + /** + * Creates a plain object from a ListSACAttachmentsResponse message. Also converts values to other types if specified. + * @param message ListSACAttachmentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.ListSACAttachmentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSACAttachmentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSACAttachmentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSACAttachmentRequest. */ + interface IGetSACAttachmentRequest { + + /** GetSACAttachmentRequest name */ + name?: (string|null); + } + + /** Represents a GetSACAttachmentRequest. */ + class GetSACAttachmentRequest implements IGetSACAttachmentRequest { + + /** + * Constructs a new GetSACAttachmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IGetSACAttachmentRequest); + + /** GetSACAttachmentRequest name. */ + public name: string; + + /** + * Creates a new GetSACAttachmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSACAttachmentRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IGetSACAttachmentRequest): google.cloud.networksecurity.v1.GetSACAttachmentRequest; + + /** + * Encodes the specified GetSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACAttachmentRequest.verify|verify} messages. + * @param message GetSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IGetSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACAttachmentRequest.verify|verify} messages. + * @param message GetSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IGetSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSACAttachmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSACAttachmentRequest + * @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.networksecurity.v1.GetSACAttachmentRequest; + + /** + * Decodes a GetSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSACAttachmentRequest + * @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.networksecurity.v1.GetSACAttachmentRequest; + + /** + * Verifies a GetSACAttachmentRequest 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 GetSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSACAttachmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.GetSACAttachmentRequest; + + /** + * Creates a plain object from a GetSACAttachmentRequest message. Also converts values to other types if specified. + * @param message GetSACAttachmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.GetSACAttachmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSACAttachmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSACAttachmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSACAttachmentRequest. */ + interface ICreateSACAttachmentRequest { + + /** CreateSACAttachmentRequest parent */ + parent?: (string|null); + + /** CreateSACAttachmentRequest sacAttachmentId */ + sacAttachmentId?: (string|null); + + /** CreateSACAttachmentRequest sacAttachment */ + sacAttachment?: (google.cloud.networksecurity.v1.ISACAttachment|null); + + /** CreateSACAttachmentRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateSACAttachmentRequest. */ + class CreateSACAttachmentRequest implements ICreateSACAttachmentRequest { + + /** + * Constructs a new CreateSACAttachmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest); + + /** CreateSACAttachmentRequest parent. */ + public parent: string; + + /** CreateSACAttachmentRequest sacAttachmentId. */ + public sacAttachmentId: string; + + /** CreateSACAttachmentRequest sacAttachment. */ + public sacAttachment?: (google.cloud.networksecurity.v1.ISACAttachment|null); + + /** CreateSACAttachmentRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateSACAttachmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSACAttachmentRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest): google.cloud.networksecurity.v1.CreateSACAttachmentRequest; + + /** + * Encodes the specified CreateSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACAttachmentRequest.verify|verify} messages. + * @param message CreateSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACAttachmentRequest.verify|verify} messages. + * @param message CreateSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSACAttachmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSACAttachmentRequest + * @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.networksecurity.v1.CreateSACAttachmentRequest; + + /** + * Decodes a CreateSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSACAttachmentRequest + * @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.networksecurity.v1.CreateSACAttachmentRequest; + + /** + * Verifies a CreateSACAttachmentRequest 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 CreateSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSACAttachmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.CreateSACAttachmentRequest; + + /** + * Creates a plain object from a CreateSACAttachmentRequest message. Also converts values to other types if specified. + * @param message CreateSACAttachmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.CreateSACAttachmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSACAttachmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSACAttachmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSACAttachmentRequest. */ + interface IDeleteSACAttachmentRequest { + + /** DeleteSACAttachmentRequest name */ + name?: (string|null); + + /** DeleteSACAttachmentRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteSACAttachmentRequest. */ + class DeleteSACAttachmentRequest implements IDeleteSACAttachmentRequest { + + /** + * Constructs a new DeleteSACAttachmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest); + + /** DeleteSACAttachmentRequest name. */ + public name: string; + + /** DeleteSACAttachmentRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteSACAttachmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSACAttachmentRequest instance + */ + public static create(properties?: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest): google.cloud.networksecurity.v1.DeleteSACAttachmentRequest; + + /** + * Encodes the specified DeleteSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACAttachmentRequest.verify|verify} messages. + * @param message DeleteSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACAttachmentRequest.verify|verify} messages. + * @param message DeleteSACAttachmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSACAttachmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSACAttachmentRequest + * @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.networksecurity.v1.DeleteSACAttachmentRequest; + + /** + * Decodes a DeleteSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSACAttachmentRequest + * @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.networksecurity.v1.DeleteSACAttachmentRequest; + + /** + * Verifies a DeleteSACAttachmentRequest 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 DeleteSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSACAttachmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networksecurity.v1.DeleteSACAttachmentRequest; + + /** + * Creates a plain object from a DeleteSACAttachmentRequest message. Also converts values to other types if specified. + * @param message DeleteSACAttachmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networksecurity.v1.DeleteSACAttachmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSACAttachmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSACAttachmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Namespace v1alpha1. */ @@ -61848,6 +63879,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -61865,6 +63899,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -62565,6 +64602,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -62579,6 +64619,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -62657,6 +64700,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -62983,6 +65138,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -62997,6 +65155,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -63321,6 +65482,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -63351,6 +65615,9 @@ export namespace google { /** FieldInfo format */ format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + + /** FieldInfo referencedTypes */ + referencedTypes?: (google.api.ITypeReference[]|null); } /** Represents a FieldInfo. */ @@ -63365,6 +65632,9 @@ export namespace google { /** FieldInfo format. */ public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + /** FieldInfo referencedTypes. */ + public referencedTypes: google.api.ITypeReference[]; + /** * Creates a new FieldInfo instance using the specified properties. * @param [properties] Properties to set @@ -63455,6 +65725,103 @@ export namespace google { } } + /** Properties of a TypeReference. */ + interface ITypeReference { + + /** TypeReference typeName */ + typeName?: (string|null); + } + + /** Represents a TypeReference. */ + class TypeReference implements ITypeReference { + + /** + * Constructs a new TypeReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ITypeReference); + + /** TypeReference typeName. */ + public typeName: string; + + /** + * Creates a new TypeReference instance using the specified properties. + * @param [properties] Properties to set + * @returns TypeReference instance + */ + public static create(properties?: google.api.ITypeReference): google.api.TypeReference; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.TypeReference; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.TypeReference; + + /** + * Verifies a TypeReference 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 TypeReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypeReference + */ + public static fromObject(object: { [k: string]: any }): google.api.TypeReference; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @param message TypeReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypeReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypeReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ResourceDescriptor. */ interface IResourceDescriptor { @@ -63811,6 +66178,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -63841,6 +66209,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -63890,6 +66261,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -64024,6 +66398,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -64065,6 +66442,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -64912,6 +67292,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -64938,6 +67321,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -65872,6 +68258,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -65930,6 +68319,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -66150,6 +68542,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -66388,6 +68895,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -66410,6 +68920,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -67002,6 +69515,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -67031,6 +69550,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -67153,6 +69678,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -67272,8 +69907,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -67288,8 +69926,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -67822,6 +70463,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-networksecurity/protos/protos.js b/packages/google-cloud-networksecurity/protos/protos.js index a626cc060760..21858c98089c 100644 --- a/packages/google-cloud-networksecurity/protos/protos.js +++ b/packages/google-cloud-networksecurity/protos/protos.js @@ -7739,6 +7739,7 @@ * @property {Object.|null} [labels] AuthzPolicy labels * @property {google.cloud.networksecurity.v1.AuthzPolicy.ITarget|null} [target] AuthzPolicy target * @property {Array.|null} [httpRules] AuthzPolicy httpRules + * @property {Array.|null} [networkRules] AuthzPolicy networkRules * @property {google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction|null} [action] AuthzPolicy action * @property {google.cloud.networksecurity.v1.AuthzPolicy.ICustomProvider|null} [customProvider] AuthzPolicy customProvider * @property {google.cloud.networksecurity.v1.AuthzPolicy.PolicyProfile|null} [policyProfile] AuthzPolicy policyProfile @@ -7755,6 +7756,7 @@ function AuthzPolicy(properties) { this.labels = {}; this.httpRules = []; + this.networkRules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7817,6 +7819,14 @@ */ AuthzPolicy.prototype.httpRules = $util.emptyArray; + /** + * AuthzPolicy networkRules. + * @member {Array.} networkRules + * @memberof google.cloud.networksecurity.v1.AuthzPolicy + * @instance + */ + AuthzPolicy.prototype.networkRules = $util.emptyArray; + /** * AuthzPolicy action. * @member {google.cloud.networksecurity.v1.AuthzPolicy.AuthzAction} action @@ -7887,6 +7897,9 @@ $root.google.cloud.networksecurity.v1.AuthzPolicy.CustomProvider.encode(message.customProvider, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); if (message.policyProfile != null && Object.hasOwnProperty.call(message, "policyProfile")) writer.uint32(/* id 11, wireType 0 =*/88).int32(message.policyProfile); + if (message.networkRules != null && message.networkRules.length) + for (var i = 0; i < message.networkRules.length; ++i) + $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.encode(message.networkRules[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); return writer; }; @@ -7972,6 +7985,12 @@ message.httpRules.push($root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.decode(reader, reader.uint32())); break; } + case 12: { + if (!(message.networkRules && message.networkRules.length)) + message.networkRules = []; + message.networkRules.push($root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.decode(reader, reader.uint32())); + break; + } case 8: { message.action = reader.int32(); break; @@ -8057,6 +8076,15 @@ return "httpRules." + error; } } + if (message.networkRules != null && message.hasOwnProperty("networkRules")) { + if (!Array.isArray(message.networkRules)) + return "networkRules: array expected"; + for (var i = 0; i < message.networkRules.length; ++i) { + var error = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.verify(message.networkRules[i]); + if (error) + return "networkRules." + error; + } + } if (message.action != null && message.hasOwnProperty("action")) switch (message.action) { default: @@ -8132,6 +8160,16 @@ message.httpRules[i] = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.fromObject(object.httpRules[i]); } } + if (object.networkRules) { + if (!Array.isArray(object.networkRules)) + throw TypeError(".google.cloud.networksecurity.v1.AuthzPolicy.networkRules: array expected"); + message.networkRules = []; + for (var i = 0; i < object.networkRules.length; ++i) { + if (typeof object.networkRules[i] !== "object") + throw TypeError(".google.cloud.networksecurity.v1.AuthzPolicy.networkRules: object expected"); + message.networkRules[i] = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.fromObject(object.networkRules[i]); + } + } switch (object.action) { default: if (typeof object.action === "number") { @@ -8197,8 +8235,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.httpRules = []; + object.networkRules = []; + } if (options.objects || options.defaults) object.labels = {}; if (options.defaults) { @@ -8238,6 +8278,11 @@ object.customProvider = $root.google.cloud.networksecurity.v1.AuthzPolicy.CustomProvider.toObject(message.customProvider, options); if (message.policyProfile != null && message.hasOwnProperty("policyProfile")) object.policyProfile = options.enums === String ? $root.google.cloud.networksecurity.v1.AuthzPolicy.PolicyProfile[message.policyProfile] === undefined ? message.policyProfile : $root.google.cloud.networksecurity.v1.AuthzPolicy.PolicyProfile[message.policyProfile] : message.policyProfile; + if (message.networkRules && message.networkRules.length) { + object.networkRules = []; + for (var j = 0; j < message.networkRules.length; ++j) + object.networkRules[j] = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.toObject(message.networkRules[j], options); + } return object; }; @@ -11221,6 +11266,7 @@ * @property {Array.|null} [paths] RequestOperation paths * @property {Array.|null} [methods] RequestOperation methods * @property {google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.IMCP|null} [mcp] RequestOperation mcp + * @property {Array.|null} [snis] RequestOperation snis */ /** @@ -11235,6 +11281,7 @@ this.hosts = []; this.paths = []; this.methods = []; + this.snis = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11281,6 +11328,14 @@ */ RequestOperation.prototype.mcp = null; + /** + * RequestOperation snis. + * @member {Array.} snis + * @memberof google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation + * @instance + */ + RequestOperation.prototype.snis = $util.emptyArray; + /** * Creates a new RequestOperation instance using the specified properties. * @function create @@ -11318,6 +11373,9 @@ writer.uint32(/* id 4, wireType 2 =*/34).string(message.methods[i]); if (message.mcp != null && Object.hasOwnProperty.call(message, "mcp")) $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.MCP.encode(message.mcp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.snis != null && message.snis.length) + for (var i = 0; i < message.snis.length; ++i) + $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.StringMatch.encode(message.snis[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -11380,6 +11438,12 @@ message.mcp = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.MCP.decode(reader, reader.uint32()); break; } + case 7: { + if (!(message.snis && message.snis.length)) + message.snis = []; + message.snis.push($root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.StringMatch.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -11450,6 +11514,15 @@ if (error) return "mcp." + error; } + if (message.snis != null && message.hasOwnProperty("snis")) { + if (!Array.isArray(message.snis)) + return "snis: array expected"; + for (var i = 0; i < message.snis.length; ++i) { + var error = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.StringMatch.verify(message.snis[i]); + if (error) + return "snis." + error; + } + } return null; }; @@ -11502,6 +11575,16 @@ throw TypeError(".google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.mcp: object expected"); message.mcp = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.MCP.fromObject(object.mcp); } + if (object.snis) { + if (!Array.isArray(object.snis)) + throw TypeError(".google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.snis: array expected"); + message.snis = []; + for (var i = 0; i < object.snis.length; ++i) { + if (typeof object.snis[i] !== "object") + throw TypeError(".google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.snis: object expected"); + message.snis[i] = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.StringMatch.fromObject(object.snis[i]); + } + } return message; }; @@ -11522,6 +11605,7 @@ object.hosts = []; object.paths = []; object.methods = []; + object.snis = []; } if (options.defaults) { object.headerSet = null; @@ -11546,6 +11630,11 @@ } if (message.mcp != null && message.hasOwnProperty("mcp")) object.mcp = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.To.RequestOperation.MCP.toObject(message.mcp, options); + if (message.snis && message.snis.length) { + object.snis = []; + for (var j = 0; j < message.snis.length; ++j) + object.snis[j] = $root.google.cloud.networksecurity.v1.AuthzPolicy.AuthzRule.StringMatch.toObject(message.snis[j], options); + } return object; }; @@ -21470,6 +21559,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|listProjectFirewallEndpoints}. + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @typedef ListProjectFirewallEndpointsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.ListFirewallEndpointsResponse} [response] ListFirewallEndpointsResponse + */ + + /** + * Calls ListProjectFirewallEndpoints. + * @function listProjectFirewallEndpoints + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IListFirewallEndpointsRequest} request ListFirewallEndpointsRequest message or plain object + * @param {google.cloud.networksecurity.v1.FirewallActivation.ListProjectFirewallEndpointsCallback} callback Node-style callback called with the error, if any, and ListFirewallEndpointsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirewallActivation.prototype.listProjectFirewallEndpoints = function listProjectFirewallEndpoints(request, callback) { + return this.rpcCall(listProjectFirewallEndpoints, $root.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest, $root.google.cloud.networksecurity.v1.ListFirewallEndpointsResponse, request, callback); + }, "name", { value: "ListProjectFirewallEndpoints" }); + + /** + * Calls ListProjectFirewallEndpoints. + * @function listProjectFirewallEndpoints + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IListFirewallEndpointsRequest} request ListFirewallEndpointsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|getFirewallEndpoint}. * @memberof google.cloud.networksecurity.v1.FirewallActivation @@ -21503,6 +21625,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|getProjectFirewallEndpoint}. + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @typedef GetProjectFirewallEndpointCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.FirewallEndpoint} [response] FirewallEndpoint + */ + + /** + * Calls GetProjectFirewallEndpoint. + * @function getProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IGetFirewallEndpointRequest} request GetFirewallEndpointRequest message or plain object + * @param {google.cloud.networksecurity.v1.FirewallActivation.GetProjectFirewallEndpointCallback} callback Node-style callback called with the error, if any, and FirewallEndpoint + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirewallActivation.prototype.getProjectFirewallEndpoint = function getProjectFirewallEndpoint(request, callback) { + return this.rpcCall(getProjectFirewallEndpoint, $root.google.cloud.networksecurity.v1.GetFirewallEndpointRequest, $root.google.cloud.networksecurity.v1.FirewallEndpoint, request, callback); + }, "name", { value: "GetProjectFirewallEndpoint" }); + + /** + * Calls GetProjectFirewallEndpoint. + * @function getProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IGetFirewallEndpointRequest} request GetFirewallEndpointRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|createFirewallEndpoint}. * @memberof google.cloud.networksecurity.v1.FirewallActivation @@ -21536,6 +21691,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|createProjectFirewallEndpoint}. + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @typedef CreateProjectFirewallEndpointCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateProjectFirewallEndpoint. + * @function createProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest} request CreateFirewallEndpointRequest message or plain object + * @param {google.cloud.networksecurity.v1.FirewallActivation.CreateProjectFirewallEndpointCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirewallActivation.prototype.createProjectFirewallEndpoint = function createProjectFirewallEndpoint(request, callback) { + return this.rpcCall(createProjectFirewallEndpoint, $root.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateProjectFirewallEndpoint" }); + + /** + * Calls CreateProjectFirewallEndpoint. + * @function createProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest} request CreateFirewallEndpointRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|deleteFirewallEndpoint}. * @memberof google.cloud.networksecurity.v1.FirewallActivation @@ -21569,6 +21757,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|deleteProjectFirewallEndpoint}. + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @typedef DeleteProjectFirewallEndpointCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProjectFirewallEndpoint. + * @function deleteProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest} request DeleteFirewallEndpointRequest message or plain object + * @param {google.cloud.networksecurity.v1.FirewallActivation.DeleteProjectFirewallEndpointCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirewallActivation.prototype.deleteProjectFirewallEndpoint = function deleteProjectFirewallEndpoint(request, callback) { + return this.rpcCall(deleteProjectFirewallEndpoint, $root.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProjectFirewallEndpoint" }); + + /** + * Calls DeleteProjectFirewallEndpoint. + * @function deleteProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest} request DeleteFirewallEndpointRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|updateFirewallEndpoint}. * @memberof google.cloud.networksecurity.v1.FirewallActivation @@ -21602,6 +21823,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|updateProjectFirewallEndpoint}. + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @typedef UpdateProjectFirewallEndpointCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateProjectFirewallEndpoint. + * @function updateProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest} request UpdateFirewallEndpointRequest message or plain object + * @param {google.cloud.networksecurity.v1.FirewallActivation.UpdateProjectFirewallEndpointCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FirewallActivation.prototype.updateProjectFirewallEndpoint = function updateProjectFirewallEndpoint(request, callback) { + return this.rpcCall(updateProjectFirewallEndpoint, $root.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateProjectFirewallEndpoint" }); + + /** + * Calls UpdateProjectFirewallEndpoint. + * @function updateProjectFirewallEndpoint + * @memberof google.cloud.networksecurity.v1.FirewallActivation + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest} request UpdateFirewallEndpointRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.networksecurity.v1.FirewallActivation|listFirewallEndpointAssociations}. * @memberof google.cloud.networksecurity.v1.FirewallActivation @@ -62429,6 +62683,371 @@ return UrlFilter; })(); + v1.SecurityProfileGroupService = (function() { + + /** + * Constructs a new SecurityProfileGroupService service. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a SecurityProfileGroupService + * @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 SecurityProfileGroupService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SecurityProfileGroupService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SecurityProfileGroupService; + + /** + * Creates new SecurityProfileGroupService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @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 {SecurityProfileGroupService} RPC service. Useful where requests and/or responses are streamed. + */ + SecurityProfileGroupService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|listSecurityProfileGroups}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef ListSecurityProfileGroupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.ListSecurityProfileGroupsResponse} [response] ListSecurityProfileGroupsResponse + */ + + /** + * Calls ListSecurityProfileGroups. + * @function listSecurityProfileGroups + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest} request ListSecurityProfileGroupsRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfileGroupsCallback} callback Node-style callback called with the error, if any, and ListSecurityProfileGroupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.listSecurityProfileGroups = function listSecurityProfileGroups(request, callback) { + return this.rpcCall(listSecurityProfileGroups, $root.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest, $root.google.cloud.networksecurity.v1.ListSecurityProfileGroupsResponse, request, callback); + }, "name", { value: "ListSecurityProfileGroups" }); + + /** + * Calls ListSecurityProfileGroups. + * @function listSecurityProfileGroups + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest} request ListSecurityProfileGroupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|getSecurityProfileGroup}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef GetSecurityProfileGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} [response] SecurityProfileGroup + */ + + /** + * Calls GetSecurityProfileGroup. + * @function getSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest} request GetSecurityProfileGroupRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileGroupCallback} callback Node-style callback called with the error, if any, and SecurityProfileGroup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.getSecurityProfileGroup = function getSecurityProfileGroup(request, callback) { + return this.rpcCall(getSecurityProfileGroup, $root.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest, $root.google.cloud.networksecurity.v1.SecurityProfileGroup, request, callback); + }, "name", { value: "GetSecurityProfileGroup" }); + + /** + * Calls GetSecurityProfileGroup. + * @function getSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest} request GetSecurityProfileGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|createSecurityProfileGroup}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef CreateSecurityProfileGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateSecurityProfileGroup. + * @function createSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest} request CreateSecurityProfileGroupRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileGroupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.createSecurityProfileGroup = function createSecurityProfileGroup(request, callback) { + return this.rpcCall(createSecurityProfileGroup, $root.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSecurityProfileGroup" }); + + /** + * Calls CreateSecurityProfileGroup. + * @function createSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest} request CreateSecurityProfileGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|updateSecurityProfileGroup}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef UpdateSecurityProfileGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateSecurityProfileGroup. + * @function updateSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest} request UpdateSecurityProfileGroupRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileGroupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.updateSecurityProfileGroup = function updateSecurityProfileGroup(request, callback) { + return this.rpcCall(updateSecurityProfileGroup, $root.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateSecurityProfileGroup" }); + + /** + * Calls UpdateSecurityProfileGroup. + * @function updateSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest} request UpdateSecurityProfileGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|deleteSecurityProfileGroup}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef DeleteSecurityProfileGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteSecurityProfileGroup. + * @function deleteSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest} request DeleteSecurityProfileGroupRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileGroupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.deleteSecurityProfileGroup = function deleteSecurityProfileGroup(request, callback) { + return this.rpcCall(deleteSecurityProfileGroup, $root.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSecurityProfileGroup" }); + + /** + * Calls DeleteSecurityProfileGroup. + * @function deleteSecurityProfileGroup + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest} request DeleteSecurityProfileGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|listSecurityProfiles}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef ListSecurityProfilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.ListSecurityProfilesResponse} [response] ListSecurityProfilesResponse + */ + + /** + * Calls ListSecurityProfiles. + * @function listSecurityProfiles + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IListSecurityProfilesRequest} request ListSecurityProfilesRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfilesCallback} callback Node-style callback called with the error, if any, and ListSecurityProfilesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.listSecurityProfiles = function listSecurityProfiles(request, callback) { + return this.rpcCall(listSecurityProfiles, $root.google.cloud.networksecurity.v1.ListSecurityProfilesRequest, $root.google.cloud.networksecurity.v1.ListSecurityProfilesResponse, request, callback); + }, "name", { value: "ListSecurityProfiles" }); + + /** + * Calls ListSecurityProfiles. + * @function listSecurityProfiles + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IListSecurityProfilesRequest} request ListSecurityProfilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|getSecurityProfile}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef GetSecurityProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.SecurityProfile} [response] SecurityProfile + */ + + /** + * Calls GetSecurityProfile. + * @function getSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSecurityProfileRequest} request GetSecurityProfileRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileCallback} callback Node-style callback called with the error, if any, and SecurityProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.getSecurityProfile = function getSecurityProfile(request, callback) { + return this.rpcCall(getSecurityProfile, $root.google.cloud.networksecurity.v1.GetSecurityProfileRequest, $root.google.cloud.networksecurity.v1.SecurityProfile, request, callback); + }, "name", { value: "GetSecurityProfile" }); + + /** + * Calls GetSecurityProfile. + * @function getSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSecurityProfileRequest} request GetSecurityProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|createSecurityProfile}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef CreateSecurityProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateSecurityProfile. + * @function createSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSecurityProfileRequest} request CreateSecurityProfileRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.createSecurityProfile = function createSecurityProfile(request, callback) { + return this.rpcCall(createSecurityProfile, $root.google.cloud.networksecurity.v1.CreateSecurityProfileRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSecurityProfile" }); + + /** + * Calls CreateSecurityProfile. + * @function createSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSecurityProfileRequest} request CreateSecurityProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|updateSecurityProfile}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef UpdateSecurityProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateSecurityProfile. + * @function updateSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest} request UpdateSecurityProfileRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.updateSecurityProfile = function updateSecurityProfile(request, callback) { + return this.rpcCall(updateSecurityProfile, $root.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateSecurityProfile" }); + + /** + * Calls UpdateSecurityProfile. + * @function updateSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest} request UpdateSecurityProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SecurityProfileGroupService|deleteSecurityProfile}. + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @typedef DeleteSecurityProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteSecurityProfile. + * @function deleteSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest} request DeleteSecurityProfileRequest message or plain object + * @param {google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SecurityProfileGroupService.prototype.deleteSecurityProfile = function deleteSecurityProfile(request, callback) { + return this.rpcCall(deleteSecurityProfile, $root.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSecurityProfile" }); + + /** + * Calls DeleteSecurityProfile. + * @function deleteSecurityProfile + * @memberof google.cloud.networksecurity.v1.SecurityProfileGroupService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest} request DeleteSecurityProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SecurityProfileGroupService; + })(); + v1.OrganizationSecurityProfileGroupService = (function() { /** @@ -65658,6 +66277,4062 @@ return DeleteSecurityProfileRequest; })(); + v1.SSERealmService = (function() { + + /** + * Constructs a new SSERealmService service. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a SSERealmService + * @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 SSERealmService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SSERealmService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SSERealmService; + + /** + * Creates new SSERealmService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @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 {SSERealmService} RPC service. Useful where requests and/or responses are streamed. + */ + SSERealmService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|listSACRealms}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef ListSACRealmsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.ListSACRealmsResponse} [response] ListSACRealmsResponse + */ + + /** + * Calls ListSACRealms. + * @function listSACRealms + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest} request ListSACRealmsRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.ListSACRealmsCallback} callback Node-style callback called with the error, if any, and ListSACRealmsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.listSACRealms = function listSACRealms(request, callback) { + return this.rpcCall(listSACRealms, $root.google.cloud.networksecurity.v1.ListSACRealmsRequest, $root.google.cloud.networksecurity.v1.ListSACRealmsResponse, request, callback); + }, "name", { value: "ListSACRealms" }); + + /** + * Calls ListSACRealms. + * @function listSACRealms + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest} request ListSACRealmsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|getSACRealm}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef GetSACRealmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.SACRealm} [response] SACRealm + */ + + /** + * Calls GetSACRealm. + * @function getSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest} request GetSACRealmRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.GetSACRealmCallback} callback Node-style callback called with the error, if any, and SACRealm + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.getSACRealm = function getSACRealm(request, callback) { + return this.rpcCall(getSACRealm, $root.google.cloud.networksecurity.v1.GetSACRealmRequest, $root.google.cloud.networksecurity.v1.SACRealm, request, callback); + }, "name", { value: "GetSACRealm" }); + + /** + * Calls GetSACRealm. + * @function getSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest} request GetSACRealmRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|createSACRealm}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef CreateSACRealmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateSACRealm. + * @function createSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest} request CreateSACRealmRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.CreateSACRealmCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.createSACRealm = function createSACRealm(request, callback) { + return this.rpcCall(createSACRealm, $root.google.cloud.networksecurity.v1.CreateSACRealmRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSACRealm" }); + + /** + * Calls CreateSACRealm. + * @function createSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest} request CreateSACRealmRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|deleteSACRealm}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef DeleteSACRealmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteSACRealm. + * @function deleteSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest} request DeleteSACRealmRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.DeleteSACRealmCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.deleteSACRealm = function deleteSACRealm(request, callback) { + return this.rpcCall(deleteSACRealm, $root.google.cloud.networksecurity.v1.DeleteSACRealmRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSACRealm" }); + + /** + * Calls DeleteSACRealm. + * @function deleteSACRealm + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest} request DeleteSACRealmRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|listSACAttachments}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef ListSACAttachmentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} [response] ListSACAttachmentsResponse + */ + + /** + * Calls ListSACAttachments. + * @function listSACAttachments + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest} request ListSACAttachmentsRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.ListSACAttachmentsCallback} callback Node-style callback called with the error, if any, and ListSACAttachmentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.listSACAttachments = function listSACAttachments(request, callback) { + return this.rpcCall(listSACAttachments, $root.google.cloud.networksecurity.v1.ListSACAttachmentsRequest, $root.google.cloud.networksecurity.v1.ListSACAttachmentsResponse, request, callback); + }, "name", { value: "ListSACAttachments" }); + + /** + * Calls ListSACAttachments. + * @function listSACAttachments + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest} request ListSACAttachmentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|getSACAttachment}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef GetSACAttachmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networksecurity.v1.SACAttachment} [response] SACAttachment + */ + + /** + * Calls GetSACAttachment. + * @function getSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest} request GetSACAttachmentRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.GetSACAttachmentCallback} callback Node-style callback called with the error, if any, and SACAttachment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.getSACAttachment = function getSACAttachment(request, callback) { + return this.rpcCall(getSACAttachment, $root.google.cloud.networksecurity.v1.GetSACAttachmentRequest, $root.google.cloud.networksecurity.v1.SACAttachment, request, callback); + }, "name", { value: "GetSACAttachment" }); + + /** + * Calls GetSACAttachment. + * @function getSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest} request GetSACAttachmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|createSACAttachment}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef CreateSACAttachmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateSACAttachment. + * @function createSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest} request CreateSACAttachmentRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.CreateSACAttachmentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.createSACAttachment = function createSACAttachment(request, callback) { + return this.rpcCall(createSACAttachment, $root.google.cloud.networksecurity.v1.CreateSACAttachmentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSACAttachment" }); + + /** + * Calls CreateSACAttachment. + * @function createSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest} request CreateSACAttachmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networksecurity.v1.SSERealmService|deleteSACAttachment}. + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @typedef DeleteSACAttachmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteSACAttachment. + * @function deleteSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest} request DeleteSACAttachmentRequest message or plain object + * @param {google.cloud.networksecurity.v1.SSERealmService.DeleteSACAttachmentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SSERealmService.prototype.deleteSACAttachment = function deleteSACAttachment(request, callback) { + return this.rpcCall(deleteSACAttachment, $root.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSACAttachment" }); + + /** + * Calls DeleteSACAttachment. + * @function deleteSACAttachment + * @memberof google.cloud.networksecurity.v1.SSERealmService + * @instance + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest} request DeleteSACAttachmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SSERealmService; + })(); + + v1.SACRealm = (function() { + + /** + * Properties of a SACRealm. + * @memberof google.cloud.networksecurity.v1 + * @interface ISACRealm + * @property {string|null} [name] SACRealm name + * @property {google.protobuf.ITimestamp|null} [createTime] SACRealm createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] SACRealm updateTime + * @property {Object.|null} [labels] SACRealm labels + * @property {google.cloud.networksecurity.v1.SACRealm.SecurityService|null} [securityService] SACRealm securityService + * @property {google.cloud.networksecurity.v1.SACRealm.IPairingKey|null} [pairingKey] SACRealm pairingKey + * @property {google.cloud.networksecurity.v1.SACRealm.State|null} [state] SACRealm state + */ + + /** + * Constructs a new SACRealm. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a SACRealm. + * @implements ISACRealm + * @constructor + * @param {google.cloud.networksecurity.v1.ISACRealm=} [properties] Properties to set + */ + function SACRealm(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SACRealm name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.name = ""; + + /** + * SACRealm createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.createTime = null; + + /** + * SACRealm updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.updateTime = null; + + /** + * SACRealm labels. + * @member {Object.} labels + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.labels = $util.emptyObject; + + /** + * SACRealm securityService. + * @member {google.cloud.networksecurity.v1.SACRealm.SecurityService} securityService + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.securityService = 0; + + /** + * SACRealm pairingKey. + * @member {google.cloud.networksecurity.v1.SACRealm.IPairingKey|null|undefined} pairingKey + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.pairingKey = null; + + /** + * SACRealm state. + * @member {google.cloud.networksecurity.v1.SACRealm.State} state + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + */ + SACRealm.prototype.state = 0; + + /** + * Creates a new SACRealm instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {google.cloud.networksecurity.v1.ISACRealm=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.SACRealm} SACRealm instance + */ + SACRealm.create = function create(properties) { + return new SACRealm(properties); + }; + + /** + * Encodes the specified SACRealm message. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {google.cloud.networksecurity.v1.ISACRealm} message SACRealm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SACRealm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.securityService != null && Object.hasOwnProperty.call(message, "securityService")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.securityService); + if (message.pairingKey != null && Object.hasOwnProperty.call(message, "pairingKey")) + $root.google.cloud.networksecurity.v1.SACRealm.PairingKey.encode(message.pairingKey, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.state); + return writer; + }; + + /** + * Encodes the specified SACRealm message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {google.cloud.networksecurity.v1.ISACRealm} message SACRealm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SACRealm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SACRealm message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.SACRealm} SACRealm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SACRealm.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.SACRealm(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 5: { + message.securityService = reader.int32(); + break; + } + case 6: { + message.pairingKey = $root.google.cloud.networksecurity.v1.SACRealm.PairingKey.decode(reader, reader.uint32()); + break; + } + case 7: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SACRealm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.SACRealm} SACRealm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SACRealm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SACRealm message. + * @function verify + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SACRealm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.securityService != null && message.hasOwnProperty("securityService")) + switch (message.securityService) { + default: + return "securityService: enum value expected"; + case 0: + case 1: + break; + } + if (message.pairingKey != null && message.hasOwnProperty("pairingKey")) { + var error = $root.google.cloud.networksecurity.v1.SACRealm.PairingKey.verify(message.pairingKey); + if (error) + return "pairingKey." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 7: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a SACRealm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.SACRealm} SACRealm + */ + SACRealm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.SACRealm) + return object; + var message = new $root.google.cloud.networksecurity.v1.SACRealm(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACRealm.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.networksecurity.v1.SACRealm.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACRealm.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]]); + } + switch (object.securityService) { + default: + if (typeof object.securityService === "number") { + message.securityService = object.securityService; + break; + } + break; + case "SECURITY_SERVICE_UNSPECIFIED": + case 0: + message.securityService = 0; + break; + case "PALO_ALTO_PRISMA_ACCESS": + case 1: + message.securityService = 1; + break; + } + if (object.pairingKey != null) { + if (typeof object.pairingKey !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACRealm.pairingKey: object expected"); + message.pairingKey = $root.google.cloud.networksecurity.v1.SACRealm.PairingKey.fromObject(object.pairingKey); + } + 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 "PENDING_PARTNER_ATTACHMENT": + case 7: + message.state = 7; + break; + case "PARTNER_ATTACHED": + case 1: + message.state = 1; + break; + case "PARTNER_DETACHED": + case 2: + message.state = 2; + break; + case "KEY_EXPIRED": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a SACRealm message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {google.cloud.networksecurity.v1.SACRealm} message SACRealm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SACRealm.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + object.securityService = options.enums === String ? "SECURITY_SERVICE_UNSPECIFIED" : 0; + object.pairingKey = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.securityService != null && message.hasOwnProperty("securityService")) + object.securityService = options.enums === String ? $root.google.cloud.networksecurity.v1.SACRealm.SecurityService[message.securityService] === undefined ? message.securityService : $root.google.cloud.networksecurity.v1.SACRealm.SecurityService[message.securityService] : message.securityService; + if (message.pairingKey != null && message.hasOwnProperty("pairingKey")) + object.pairingKey = $root.google.cloud.networksecurity.v1.SACRealm.PairingKey.toObject(message.pairingKey, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.networksecurity.v1.SACRealm.State[message.state] === undefined ? message.state : $root.google.cloud.networksecurity.v1.SACRealm.State[message.state] : message.state; + return object; + }; + + /** + * Converts this SACRealm to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.SACRealm + * @instance + * @returns {Object.} JSON object + */ + SACRealm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SACRealm + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.SACRealm + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SACRealm.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.SACRealm"; + }; + + SACRealm.PairingKey = (function() { + + /** + * Properties of a PairingKey. + * @memberof google.cloud.networksecurity.v1.SACRealm + * @interface IPairingKey + * @property {string|null} [key] PairingKey key + * @property {google.protobuf.ITimestamp|null} [expireTime] PairingKey expireTime + */ + + /** + * Constructs a new PairingKey. + * @memberof google.cloud.networksecurity.v1.SACRealm + * @classdesc Represents a PairingKey. + * @implements IPairingKey + * @constructor + * @param {google.cloud.networksecurity.v1.SACRealm.IPairingKey=} [properties] Properties to set + */ + function PairingKey(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]]; + } + + /** + * PairingKey key. + * @member {string} key + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @instance + */ + PairingKey.prototype.key = ""; + + /** + * PairingKey expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @instance + */ + PairingKey.prototype.expireTime = null; + + /** + * Creates a new PairingKey instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {google.cloud.networksecurity.v1.SACRealm.IPairingKey=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.SACRealm.PairingKey} PairingKey instance + */ + PairingKey.create = function create(properties) { + return new PairingKey(properties); + }; + + /** + * Encodes the specified PairingKey message. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.PairingKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {google.cloud.networksecurity.v1.SACRealm.IPairingKey} message PairingKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PairingKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PairingKey message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACRealm.PairingKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {google.cloud.networksecurity.v1.SACRealm.IPairingKey} message PairingKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PairingKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PairingKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.SACRealm.PairingKey} PairingKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PairingKey.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.SACRealm.PairingKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PairingKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.SACRealm.PairingKey} PairingKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PairingKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PairingKey message. + * @function verify + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PairingKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + return null; + }; + + /** + * Creates a PairingKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.SACRealm.PairingKey} PairingKey + */ + PairingKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.SACRealm.PairingKey) + return object; + var message = new $root.google.cloud.networksecurity.v1.SACRealm.PairingKey(); + if (object.key != null) + message.key = String(object.key); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACRealm.PairingKey.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + return message; + }; + + /** + * Creates a plain object from a PairingKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {google.cloud.networksecurity.v1.SACRealm.PairingKey} message PairingKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PairingKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.expireTime = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + return object; + }; + + /** + * Converts this PairingKey to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @instance + * @returns {Object.} JSON object + */ + PairingKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PairingKey + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.SACRealm.PairingKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PairingKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.SACRealm.PairingKey"; + }; + + return PairingKey; + })(); + + /** + * SecurityService enum. + * @name google.cloud.networksecurity.v1.SACRealm.SecurityService + * @enum {number} + * @property {number} SECURITY_SERVICE_UNSPECIFIED=0 SECURITY_SERVICE_UNSPECIFIED value + * @property {number} PALO_ALTO_PRISMA_ACCESS=1 PALO_ALTO_PRISMA_ACCESS value + */ + SACRealm.SecurityService = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SECURITY_SERVICE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PALO_ALTO_PRISMA_ACCESS"] = 1; + return values; + })(); + + /** + * State enum. + * @name google.cloud.networksecurity.v1.SACRealm.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING_PARTNER_ATTACHMENT=7 PENDING_PARTNER_ATTACHMENT value + * @property {number} PARTNER_ATTACHED=1 PARTNER_ATTACHED value + * @property {number} PARTNER_DETACHED=2 PARTNER_DETACHED value + * @property {number} KEY_EXPIRED=3 KEY_EXPIRED value + */ + SACRealm.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[7] = "PENDING_PARTNER_ATTACHMENT"] = 7; + values[valuesById[1] = "PARTNER_ATTACHED"] = 1; + values[valuesById[2] = "PARTNER_DETACHED"] = 2; + values[valuesById[3] = "KEY_EXPIRED"] = 3; + return values; + })(); + + return SACRealm; + })(); + + v1.ListSACRealmsRequest = (function() { + + /** + * Properties of a ListSACRealmsRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IListSACRealmsRequest + * @property {string|null} [parent] ListSACRealmsRequest parent + * @property {number|null} [pageSize] ListSACRealmsRequest pageSize + * @property {string|null} [pageToken] ListSACRealmsRequest pageToken + * @property {string|null} [filter] ListSACRealmsRequest filter + * @property {string|null} [orderBy] ListSACRealmsRequest orderBy + */ + + /** + * Constructs a new ListSACRealmsRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a ListSACRealmsRequest. + * @implements IListSACRealmsRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest=} [properties] Properties to set + */ + function ListSACRealmsRequest(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]]; + } + + /** + * ListSACRealmsRequest parent. + * @member {string} parent + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + */ + ListSACRealmsRequest.prototype.parent = ""; + + /** + * ListSACRealmsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + */ + ListSACRealmsRequest.prototype.pageSize = 0; + + /** + * ListSACRealmsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + */ + ListSACRealmsRequest.prototype.pageToken = ""; + + /** + * ListSACRealmsRequest filter. + * @member {string} filter + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + */ + ListSACRealmsRequest.prototype.filter = ""; + + /** + * ListSACRealmsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + */ + ListSACRealmsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListSACRealmsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.ListSACRealmsRequest} ListSACRealmsRequest instance + */ + ListSACRealmsRequest.create = function create(properties) { + return new ListSACRealmsRequest(properties); + }; + + /** + * Encodes the specified ListSACRealmsRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest} message ListSACRealmsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACRealmsRequest.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 ListSACRealmsRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsRequest} message ListSACRealmsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACRealmsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSACRealmsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.ListSACRealmsRequest} ListSACRealmsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACRealmsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.ListSACRealmsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + 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 ListSACRealmsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.ListSACRealmsRequest} ListSACRealmsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACRealmsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSACRealmsRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSACRealmsRequest.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 ListSACRealmsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.ListSACRealmsRequest} ListSACRealmsRequest + */ + ListSACRealmsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.ListSACRealmsRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.ListSACRealmsRequest(); + 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 ListSACRealmsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {google.cloud.networksecurity.v1.ListSACRealmsRequest} message ListSACRealmsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSACRealmsRequest.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 ListSACRealmsRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @instance + * @returns {Object.} JSON object + */ + ListSACRealmsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSACRealmsRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.ListSACRealmsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSACRealmsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.ListSACRealmsRequest"; + }; + + return ListSACRealmsRequest; + })(); + + v1.ListSACRealmsResponse = (function() { + + /** + * Properties of a ListSACRealmsResponse. + * @memberof google.cloud.networksecurity.v1 + * @interface IListSACRealmsResponse + * @property {Array.|null} [sacRealms] ListSACRealmsResponse sacRealms + * @property {string|null} [nextPageToken] ListSACRealmsResponse nextPageToken + * @property {Array.|null} [unreachable] ListSACRealmsResponse unreachable + */ + + /** + * Constructs a new ListSACRealmsResponse. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a ListSACRealmsResponse. + * @implements IListSACRealmsResponse + * @constructor + * @param {google.cloud.networksecurity.v1.IListSACRealmsResponse=} [properties] Properties to set + */ + function ListSACRealmsResponse(properties) { + this.sacRealms = []; + 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]]; + } + + /** + * ListSACRealmsResponse sacRealms. + * @member {Array.} sacRealms + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @instance + */ + ListSACRealmsResponse.prototype.sacRealms = $util.emptyArray; + + /** + * ListSACRealmsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @instance + */ + ListSACRealmsResponse.prototype.nextPageToken = ""; + + /** + * ListSACRealmsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @instance + */ + ListSACRealmsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListSACRealmsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsResponse=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.ListSACRealmsResponse} ListSACRealmsResponse instance + */ + ListSACRealmsResponse.create = function create(properties) { + return new ListSACRealmsResponse(properties); + }; + + /** + * Encodes the specified ListSACRealmsResponse message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsResponse} message ListSACRealmsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACRealmsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sacRealms != null && message.sacRealms.length) + for (var i = 0; i < message.sacRealms.length; ++i) + $root.google.cloud.networksecurity.v1.SACRealm.encode(message.sacRealms[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 ListSACRealmsResponse message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACRealmsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACRealmsResponse} message ListSACRealmsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACRealmsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSACRealmsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.ListSACRealmsResponse} ListSACRealmsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACRealmsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.ListSACRealmsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.sacRealms && message.sacRealms.length)) + message.sacRealms = []; + message.sacRealms.push($root.google.cloud.networksecurity.v1.SACRealm.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 ListSACRealmsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.ListSACRealmsResponse} ListSACRealmsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACRealmsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSACRealmsResponse message. + * @function verify + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSACRealmsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sacRealms != null && message.hasOwnProperty("sacRealms")) { + if (!Array.isArray(message.sacRealms)) + return "sacRealms: array expected"; + for (var i = 0; i < message.sacRealms.length; ++i) { + var error = $root.google.cloud.networksecurity.v1.SACRealm.verify(message.sacRealms[i]); + if (error) + return "sacRealms." + 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 ListSACRealmsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.ListSACRealmsResponse} ListSACRealmsResponse + */ + ListSACRealmsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.ListSACRealmsResponse) + return object; + var message = new $root.google.cloud.networksecurity.v1.ListSACRealmsResponse(); + if (object.sacRealms) { + if (!Array.isArray(object.sacRealms)) + throw TypeError(".google.cloud.networksecurity.v1.ListSACRealmsResponse.sacRealms: array expected"); + message.sacRealms = []; + for (var i = 0; i < object.sacRealms.length; ++i) { + if (typeof object.sacRealms[i] !== "object") + throw TypeError(".google.cloud.networksecurity.v1.ListSACRealmsResponse.sacRealms: object expected"); + message.sacRealms[i] = $root.google.cloud.networksecurity.v1.SACRealm.fromObject(object.sacRealms[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.networksecurity.v1.ListSACRealmsResponse.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 ListSACRealmsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {google.cloud.networksecurity.v1.ListSACRealmsResponse} message ListSACRealmsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSACRealmsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.sacRealms = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.sacRealms && message.sacRealms.length) { + object.sacRealms = []; + for (var j = 0; j < message.sacRealms.length; ++j) + object.sacRealms[j] = $root.google.cloud.networksecurity.v1.SACRealm.toObject(message.sacRealms[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 ListSACRealmsResponse to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @instance + * @returns {Object.} JSON object + */ + ListSACRealmsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSACRealmsResponse + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.ListSACRealmsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSACRealmsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.ListSACRealmsResponse"; + }; + + return ListSACRealmsResponse; + })(); + + v1.GetSACRealmRequest = (function() { + + /** + * Properties of a GetSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IGetSACRealmRequest + * @property {string|null} [name] GetSACRealmRequest name + */ + + /** + * Constructs a new GetSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a GetSACRealmRequest. + * @implements IGetSACRealmRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest=} [properties] Properties to set + */ + function GetSACRealmRequest(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]]; + } + + /** + * GetSACRealmRequest name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @instance + */ + GetSACRealmRequest.prototype.name = ""; + + /** + * Creates a new GetSACRealmRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.GetSACRealmRequest} GetSACRealmRequest instance + */ + GetSACRealmRequest.create = function create(properties) { + return new GetSACRealmRequest(properties); + }; + + /** + * Encodes the specified GetSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACRealmRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest} message GetSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSACRealmRequest.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 GetSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACRealmRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACRealmRequest} message GetSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSACRealmRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSACRealmRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.GetSACRealmRequest} GetSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSACRealmRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.GetSACRealmRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSACRealmRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.GetSACRealmRequest} GetSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSACRealmRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSACRealmRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSACRealmRequest.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 GetSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.GetSACRealmRequest} GetSACRealmRequest + */ + GetSACRealmRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.GetSACRealmRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.GetSACRealmRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSACRealmRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.GetSACRealmRequest} message GetSACRealmRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSACRealmRequest.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 GetSACRealmRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @instance + * @returns {Object.} JSON object + */ + GetSACRealmRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSACRealmRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.GetSACRealmRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSACRealmRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.GetSACRealmRequest"; + }; + + return GetSACRealmRequest; + })(); + + v1.CreateSACRealmRequest = (function() { + + /** + * Properties of a CreateSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface ICreateSACRealmRequest + * @property {string|null} [parent] CreateSACRealmRequest parent + * @property {string|null} [sacRealmId] CreateSACRealmRequest sacRealmId + * @property {google.cloud.networksecurity.v1.ISACRealm|null} [sacRealm] CreateSACRealmRequest sacRealm + * @property {string|null} [requestId] CreateSACRealmRequest requestId + */ + + /** + * Constructs a new CreateSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a CreateSACRealmRequest. + * @implements ICreateSACRealmRequest + * @constructor + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest=} [properties] Properties to set + */ + function CreateSACRealmRequest(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]]; + } + + /** + * CreateSACRealmRequest parent. + * @member {string} parent + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @instance + */ + CreateSACRealmRequest.prototype.parent = ""; + + /** + * CreateSACRealmRequest sacRealmId. + * @member {string} sacRealmId + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @instance + */ + CreateSACRealmRequest.prototype.sacRealmId = ""; + + /** + * CreateSACRealmRequest sacRealm. + * @member {google.cloud.networksecurity.v1.ISACRealm|null|undefined} sacRealm + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @instance + */ + CreateSACRealmRequest.prototype.sacRealm = null; + + /** + * CreateSACRealmRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @instance + */ + CreateSACRealmRequest.prototype.requestId = ""; + + /** + * Creates a new CreateSACRealmRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.CreateSACRealmRequest} CreateSACRealmRequest instance + */ + CreateSACRealmRequest.create = function create(properties) { + return new CreateSACRealmRequest(properties); + }; + + /** + * Encodes the specified CreateSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACRealmRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest} message CreateSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSACRealmRequest.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.sacRealmId != null && Object.hasOwnProperty.call(message, "sacRealmId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sacRealmId); + if (message.sacRealm != null && Object.hasOwnProperty.call(message, "sacRealm")) + $root.google.cloud.networksecurity.v1.SACRealm.encode(message.sacRealm, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified CreateSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACRealmRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACRealmRequest} message CreateSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSACRealmRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSACRealmRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.CreateSACRealmRequest} CreateSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSACRealmRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.CreateSACRealmRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sacRealmId = reader.string(); + break; + } + case 3: { + message.sacRealm = $root.google.cloud.networksecurity.v1.SACRealm.decode(reader, reader.uint32()); + break; + } + case 4: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSACRealmRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.CreateSACRealmRequest} CreateSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSACRealmRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSACRealmRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSACRealmRequest.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.sacRealmId != null && message.hasOwnProperty("sacRealmId")) + if (!$util.isString(message.sacRealmId)) + return "sacRealmId: string expected"; + if (message.sacRealm != null && message.hasOwnProperty("sacRealm")) { + var error = $root.google.cloud.networksecurity.v1.SACRealm.verify(message.sacRealm); + if (error) + return "sacRealm." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.CreateSACRealmRequest} CreateSACRealmRequest + */ + CreateSACRealmRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.CreateSACRealmRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.CreateSACRealmRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sacRealmId != null) + message.sacRealmId = String(object.sacRealmId); + if (object.sacRealm != null) { + if (typeof object.sacRealm !== "object") + throw TypeError(".google.cloud.networksecurity.v1.CreateSACRealmRequest.sacRealm: object expected"); + message.sacRealm = $root.google.cloud.networksecurity.v1.SACRealm.fromObject(object.sacRealm); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateSACRealmRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.CreateSACRealmRequest} message CreateSACRealmRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSACRealmRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sacRealmId = ""; + object.sacRealm = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sacRealmId != null && message.hasOwnProperty("sacRealmId")) + object.sacRealmId = message.sacRealmId; + if (message.sacRealm != null && message.hasOwnProperty("sacRealm")) + object.sacRealm = $root.google.cloud.networksecurity.v1.SACRealm.toObject(message.sacRealm, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateSACRealmRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSACRealmRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSACRealmRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.CreateSACRealmRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSACRealmRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.CreateSACRealmRequest"; + }; + + return CreateSACRealmRequest; + })(); + + v1.DeleteSACRealmRequest = (function() { + + /** + * Properties of a DeleteSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IDeleteSACRealmRequest + * @property {string|null} [name] DeleteSACRealmRequest name + * @property {string|null} [requestId] DeleteSACRealmRequest requestId + */ + + /** + * Constructs a new DeleteSACRealmRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a DeleteSACRealmRequest. + * @implements IDeleteSACRealmRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest=} [properties] Properties to set + */ + function DeleteSACRealmRequest(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]]; + } + + /** + * DeleteSACRealmRequest name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @instance + */ + DeleteSACRealmRequest.prototype.name = ""; + + /** + * DeleteSACRealmRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @instance + */ + DeleteSACRealmRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteSACRealmRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.DeleteSACRealmRequest} DeleteSACRealmRequest instance + */ + DeleteSACRealmRequest.create = function create(properties) { + return new DeleteSACRealmRequest(properties); + }; + + /** + * Encodes the specified DeleteSACRealmRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACRealmRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest} message DeleteSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSACRealmRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified DeleteSACRealmRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACRealmRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACRealmRequest} message DeleteSACRealmRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSACRealmRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSACRealmRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.DeleteSACRealmRequest} DeleteSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSACRealmRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.DeleteSACRealmRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSACRealmRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.DeleteSACRealmRequest} DeleteSACRealmRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSACRealmRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSACRealmRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSACRealmRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a DeleteSACRealmRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.DeleteSACRealmRequest} DeleteSACRealmRequest + */ + DeleteSACRealmRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.DeleteSACRealmRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.DeleteSACRealmRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a DeleteSACRealmRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {google.cloud.networksecurity.v1.DeleteSACRealmRequest} message DeleteSACRealmRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSACRealmRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.requestId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this DeleteSACRealmRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSACRealmRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSACRealmRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.DeleteSACRealmRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSACRealmRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.DeleteSACRealmRequest"; + }; + + return DeleteSACRealmRequest; + })(); + + v1.SACAttachment = (function() { + + /** + * Properties of a SACAttachment. + * @memberof google.cloud.networksecurity.v1 + * @interface ISACAttachment + * @property {string|null} [name] SACAttachment name + * @property {google.protobuf.ITimestamp|null} [createTime] SACAttachment createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] SACAttachment updateTime + * @property {Object.|null} [labels] SACAttachment labels + * @property {string|null} [sacRealm] SACAttachment sacRealm + * @property {string|null} [nccGateway] SACAttachment nccGateway + * @property {google.cloud.networksecurity.v1.SACAttachment.State|null} [state] SACAttachment state + */ + + /** + * Constructs a new SACAttachment. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a SACAttachment. + * @implements ISACAttachment + * @constructor + * @param {google.cloud.networksecurity.v1.ISACAttachment=} [properties] Properties to set + */ + function SACAttachment(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SACAttachment name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.name = ""; + + /** + * SACAttachment createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.createTime = null; + + /** + * SACAttachment updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.updateTime = null; + + /** + * SACAttachment labels. + * @member {Object.} labels + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.labels = $util.emptyObject; + + /** + * SACAttachment sacRealm. + * @member {string} sacRealm + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.sacRealm = ""; + + /** + * SACAttachment nccGateway. + * @member {string} nccGateway + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.nccGateway = ""; + + /** + * SACAttachment state. + * @member {google.cloud.networksecurity.v1.SACAttachment.State} state + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + */ + SACAttachment.prototype.state = 0; + + /** + * Creates a new SACAttachment instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {google.cloud.networksecurity.v1.ISACAttachment=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.SACAttachment} SACAttachment instance + */ + SACAttachment.create = function create(properties) { + return new SACAttachment(properties); + }; + + /** + * Encodes the specified SACAttachment message. Does not implicitly {@link google.cloud.networksecurity.v1.SACAttachment.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {google.cloud.networksecurity.v1.ISACAttachment} message SACAttachment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SACAttachment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.sacRealm != null && Object.hasOwnProperty.call(message, "sacRealm")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.sacRealm); + if (message.nccGateway != null && Object.hasOwnProperty.call(message, "nccGateway")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nccGateway); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.state); + return writer; + }; + + /** + * Encodes the specified SACAttachment message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.SACAttachment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {google.cloud.networksecurity.v1.ISACAttachment} message SACAttachment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SACAttachment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SACAttachment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.SACAttachment} SACAttachment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SACAttachment.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.SACAttachment(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 5: { + message.sacRealm = reader.string(); + break; + } + case 6: { + message.nccGateway = reader.string(); + break; + } + case 10: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SACAttachment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.SACAttachment} SACAttachment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SACAttachment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SACAttachment message. + * @function verify + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SACAttachment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.sacRealm != null && message.hasOwnProperty("sacRealm")) + if (!$util.isString(message.sacRealm)) + return "sacRealm: string expected"; + if (message.nccGateway != null && message.hasOwnProperty("nccGateway")) + if (!$util.isString(message.nccGateway)) + return "nccGateway: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a SACAttachment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.SACAttachment} SACAttachment + */ + SACAttachment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.SACAttachment) + return object; + var message = new $root.google.cloud.networksecurity.v1.SACAttachment(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACAttachment.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.networksecurity.v1.SACAttachment.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.networksecurity.v1.SACAttachment.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.sacRealm != null) + message.sacRealm = String(object.sacRealm); + if (object.nccGateway != null) + message.nccGateway = String(object.nccGateway); + 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 "PENDING_PARTNER_ATTACHMENT": + case 1: + message.state = 1; + break; + case "PARTNER_ATTACHED": + case 2: + message.state = 2; + break; + case "PARTNER_DETACHED": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a SACAttachment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {google.cloud.networksecurity.v1.SACAttachment} message SACAttachment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SACAttachment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + object.sacRealm = ""; + object.nccGateway = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.sacRealm != null && message.hasOwnProperty("sacRealm")) + object.sacRealm = message.sacRealm; + if (message.nccGateway != null && message.hasOwnProperty("nccGateway")) + object.nccGateway = message.nccGateway; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.networksecurity.v1.SACAttachment.State[message.state] === undefined ? message.state : $root.google.cloud.networksecurity.v1.SACAttachment.State[message.state] : message.state; + return object; + }; + + /** + * Converts this SACAttachment to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @instance + * @returns {Object.} JSON object + */ + SACAttachment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SACAttachment + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.SACAttachment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SACAttachment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.SACAttachment"; + }; + + /** + * State enum. + * @name google.cloud.networksecurity.v1.SACAttachment.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING_PARTNER_ATTACHMENT=1 PENDING_PARTNER_ATTACHMENT value + * @property {number} PARTNER_ATTACHED=2 PARTNER_ATTACHED value + * @property {number} PARTNER_DETACHED=3 PARTNER_DETACHED value + */ + SACAttachment.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING_PARTNER_ATTACHMENT"] = 1; + values[valuesById[2] = "PARTNER_ATTACHED"] = 2; + values[valuesById[3] = "PARTNER_DETACHED"] = 3; + return values; + })(); + + return SACAttachment; + })(); + + v1.ListSACAttachmentsRequest = (function() { + + /** + * Properties of a ListSACAttachmentsRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IListSACAttachmentsRequest + * @property {string|null} [parent] ListSACAttachmentsRequest parent + * @property {number|null} [pageSize] ListSACAttachmentsRequest pageSize + * @property {string|null} [pageToken] ListSACAttachmentsRequest pageToken + * @property {string|null} [filter] ListSACAttachmentsRequest filter + * @property {string|null} [orderBy] ListSACAttachmentsRequest orderBy + */ + + /** + * Constructs a new ListSACAttachmentsRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a ListSACAttachmentsRequest. + * @implements IListSACAttachmentsRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest=} [properties] Properties to set + */ + function ListSACAttachmentsRequest(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]]; + } + + /** + * ListSACAttachmentsRequest parent. + * @member {string} parent + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + */ + ListSACAttachmentsRequest.prototype.parent = ""; + + /** + * ListSACAttachmentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + */ + ListSACAttachmentsRequest.prototype.pageSize = 0; + + /** + * ListSACAttachmentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + */ + ListSACAttachmentsRequest.prototype.pageToken = ""; + + /** + * ListSACAttachmentsRequest filter. + * @member {string} filter + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + */ + ListSACAttachmentsRequest.prototype.filter = ""; + + /** + * ListSACAttachmentsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + */ + ListSACAttachmentsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListSACAttachmentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsRequest} ListSACAttachmentsRequest instance + */ + ListSACAttachmentsRequest.create = function create(properties) { + return new ListSACAttachmentsRequest(properties); + }; + + /** + * Encodes the specified ListSACAttachmentsRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest} message ListSACAttachmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACAttachmentsRequest.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 ListSACAttachmentsRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsRequest} message ListSACAttachmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACAttachmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSACAttachmentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsRequest} ListSACAttachmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACAttachmentsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + 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 ListSACAttachmentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsRequest} ListSACAttachmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACAttachmentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSACAttachmentsRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSACAttachmentsRequest.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 ListSACAttachmentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsRequest} ListSACAttachmentsRequest + */ + ListSACAttachmentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.ListSACAttachmentsRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(); + 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 ListSACAttachmentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {google.cloud.networksecurity.v1.ListSACAttachmentsRequest} message ListSACAttachmentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSACAttachmentsRequest.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 ListSACAttachmentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListSACAttachmentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSACAttachmentsRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSACAttachmentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.ListSACAttachmentsRequest"; + }; + + return ListSACAttachmentsRequest; + })(); + + v1.ListSACAttachmentsResponse = (function() { + + /** + * Properties of a ListSACAttachmentsResponse. + * @memberof google.cloud.networksecurity.v1 + * @interface IListSACAttachmentsResponse + * @property {Array.|null} [sacAttachments] ListSACAttachmentsResponse sacAttachments + * @property {string|null} [nextPageToken] ListSACAttachmentsResponse nextPageToken + * @property {Array.|null} [unreachable] ListSACAttachmentsResponse unreachable + */ + + /** + * Constructs a new ListSACAttachmentsResponse. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a ListSACAttachmentsResponse. + * @implements IListSACAttachmentsResponse + * @constructor + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsResponse=} [properties] Properties to set + */ + function ListSACAttachmentsResponse(properties) { + this.sacAttachments = []; + 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]]; + } + + /** + * ListSACAttachmentsResponse sacAttachments. + * @member {Array.} sacAttachments + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @instance + */ + ListSACAttachmentsResponse.prototype.sacAttachments = $util.emptyArray; + + /** + * ListSACAttachmentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @instance + */ + ListSACAttachmentsResponse.prototype.nextPageToken = ""; + + /** + * ListSACAttachmentsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @instance + */ + ListSACAttachmentsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListSACAttachmentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsResponse=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} ListSACAttachmentsResponse instance + */ + ListSACAttachmentsResponse.create = function create(properties) { + return new ListSACAttachmentsResponse(properties); + }; + + /** + * Encodes the specified ListSACAttachmentsResponse message. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsResponse} message ListSACAttachmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACAttachmentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sacAttachments != null && message.sacAttachments.length) + for (var i = 0; i < message.sacAttachments.length; ++i) + $root.google.cloud.networksecurity.v1.SACAttachment.encode(message.sacAttachments[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 ListSACAttachmentsResponse message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.ListSACAttachmentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {google.cloud.networksecurity.v1.IListSACAttachmentsResponse} message ListSACAttachmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSACAttachmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSACAttachmentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} ListSACAttachmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACAttachmentsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.ListSACAttachmentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.sacAttachments && message.sacAttachments.length)) + message.sacAttachments = []; + message.sacAttachments.push($root.google.cloud.networksecurity.v1.SACAttachment.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 ListSACAttachmentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} ListSACAttachmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSACAttachmentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSACAttachmentsResponse message. + * @function verify + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSACAttachmentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sacAttachments != null && message.hasOwnProperty("sacAttachments")) { + if (!Array.isArray(message.sacAttachments)) + return "sacAttachments: array expected"; + for (var i = 0; i < message.sacAttachments.length; ++i) { + var error = $root.google.cloud.networksecurity.v1.SACAttachment.verify(message.sacAttachments[i]); + if (error) + return "sacAttachments." + 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 ListSACAttachmentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} ListSACAttachmentsResponse + */ + ListSACAttachmentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.ListSACAttachmentsResponse) + return object; + var message = new $root.google.cloud.networksecurity.v1.ListSACAttachmentsResponse(); + if (object.sacAttachments) { + if (!Array.isArray(object.sacAttachments)) + throw TypeError(".google.cloud.networksecurity.v1.ListSACAttachmentsResponse.sacAttachments: array expected"); + message.sacAttachments = []; + for (var i = 0; i < object.sacAttachments.length; ++i) { + if (typeof object.sacAttachments[i] !== "object") + throw TypeError(".google.cloud.networksecurity.v1.ListSACAttachmentsResponse.sacAttachments: object expected"); + message.sacAttachments[i] = $root.google.cloud.networksecurity.v1.SACAttachment.fromObject(object.sacAttachments[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.networksecurity.v1.ListSACAttachmentsResponse.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 ListSACAttachmentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {google.cloud.networksecurity.v1.ListSACAttachmentsResponse} message ListSACAttachmentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSACAttachmentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.sacAttachments = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.sacAttachments && message.sacAttachments.length) { + object.sacAttachments = []; + for (var j = 0; j < message.sacAttachments.length; ++j) + object.sacAttachments[j] = $root.google.cloud.networksecurity.v1.SACAttachment.toObject(message.sacAttachments[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 ListSACAttachmentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListSACAttachmentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSACAttachmentsResponse + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.ListSACAttachmentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSACAttachmentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.ListSACAttachmentsResponse"; + }; + + return ListSACAttachmentsResponse; + })(); + + v1.GetSACAttachmentRequest = (function() { + + /** + * Properties of a GetSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IGetSACAttachmentRequest + * @property {string|null} [name] GetSACAttachmentRequest name + */ + + /** + * Constructs a new GetSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a GetSACAttachmentRequest. + * @implements IGetSACAttachmentRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest=} [properties] Properties to set + */ + function GetSACAttachmentRequest(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]]; + } + + /** + * GetSACAttachmentRequest name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @instance + */ + GetSACAttachmentRequest.prototype.name = ""; + + /** + * Creates a new GetSACAttachmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.GetSACAttachmentRequest} GetSACAttachmentRequest instance + */ + GetSACAttachmentRequest.create = function create(properties) { + return new GetSACAttachmentRequest(properties); + }; + + /** + * Encodes the specified GetSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACAttachmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest} message GetSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSACAttachmentRequest.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 GetSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.GetSACAttachmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IGetSACAttachmentRequest} message GetSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSACAttachmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSACAttachmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.GetSACAttachmentRequest} GetSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSACAttachmentRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.GetSACAttachmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.GetSACAttachmentRequest} GetSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSACAttachmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSACAttachmentRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSACAttachmentRequest.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 GetSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.GetSACAttachmentRequest} GetSACAttachmentRequest + */ + GetSACAttachmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.GetSACAttachmentRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.GetSACAttachmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSACAttachmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.GetSACAttachmentRequest} message GetSACAttachmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSACAttachmentRequest.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 GetSACAttachmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetSACAttachmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSACAttachmentRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.GetSACAttachmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSACAttachmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.GetSACAttachmentRequest"; + }; + + return GetSACAttachmentRequest; + })(); + + v1.CreateSACAttachmentRequest = (function() { + + /** + * Properties of a CreateSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface ICreateSACAttachmentRequest + * @property {string|null} [parent] CreateSACAttachmentRequest parent + * @property {string|null} [sacAttachmentId] CreateSACAttachmentRequest sacAttachmentId + * @property {google.cloud.networksecurity.v1.ISACAttachment|null} [sacAttachment] CreateSACAttachmentRequest sacAttachment + * @property {string|null} [requestId] CreateSACAttachmentRequest requestId + */ + + /** + * Constructs a new CreateSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a CreateSACAttachmentRequest. + * @implements ICreateSACAttachmentRequest + * @constructor + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest=} [properties] Properties to set + */ + function CreateSACAttachmentRequest(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]]; + } + + /** + * CreateSACAttachmentRequest parent. + * @member {string} parent + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @instance + */ + CreateSACAttachmentRequest.prototype.parent = ""; + + /** + * CreateSACAttachmentRequest sacAttachmentId. + * @member {string} sacAttachmentId + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @instance + */ + CreateSACAttachmentRequest.prototype.sacAttachmentId = ""; + + /** + * CreateSACAttachmentRequest sacAttachment. + * @member {google.cloud.networksecurity.v1.ISACAttachment|null|undefined} sacAttachment + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @instance + */ + CreateSACAttachmentRequest.prototype.sacAttachment = null; + + /** + * CreateSACAttachmentRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @instance + */ + CreateSACAttachmentRequest.prototype.requestId = ""; + + /** + * Creates a new CreateSACAttachmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.CreateSACAttachmentRequest} CreateSACAttachmentRequest instance + */ + CreateSACAttachmentRequest.create = function create(properties) { + return new CreateSACAttachmentRequest(properties); + }; + + /** + * Encodes the specified CreateSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACAttachmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest} message CreateSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSACAttachmentRequest.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.sacAttachmentId != null && Object.hasOwnProperty.call(message, "sacAttachmentId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sacAttachmentId); + if (message.sacAttachment != null && Object.hasOwnProperty.call(message, "sacAttachment")) + $root.google.cloud.networksecurity.v1.SACAttachment.encode(message.sacAttachment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified CreateSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.CreateSACAttachmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.ICreateSACAttachmentRequest} message CreateSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSACAttachmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSACAttachmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.CreateSACAttachmentRequest} CreateSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSACAttachmentRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sacAttachmentId = reader.string(); + break; + } + case 3: { + message.sacAttachment = $root.google.cloud.networksecurity.v1.SACAttachment.decode(reader, reader.uint32()); + break; + } + case 4: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.CreateSACAttachmentRequest} CreateSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSACAttachmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSACAttachmentRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSACAttachmentRequest.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.sacAttachmentId != null && message.hasOwnProperty("sacAttachmentId")) + if (!$util.isString(message.sacAttachmentId)) + return "sacAttachmentId: string expected"; + if (message.sacAttachment != null && message.hasOwnProperty("sacAttachment")) { + var error = $root.google.cloud.networksecurity.v1.SACAttachment.verify(message.sacAttachment); + if (error) + return "sacAttachment." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.CreateSACAttachmentRequest} CreateSACAttachmentRequest + */ + CreateSACAttachmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.CreateSACAttachmentRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sacAttachmentId != null) + message.sacAttachmentId = String(object.sacAttachmentId); + if (object.sacAttachment != null) { + if (typeof object.sacAttachment !== "object") + throw TypeError(".google.cloud.networksecurity.v1.CreateSACAttachmentRequest.sacAttachment: object expected"); + message.sacAttachment = $root.google.cloud.networksecurity.v1.SACAttachment.fromObject(object.sacAttachment); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateSACAttachmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.CreateSACAttachmentRequest} message CreateSACAttachmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSACAttachmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sacAttachmentId = ""; + object.sacAttachment = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sacAttachmentId != null && message.hasOwnProperty("sacAttachmentId")) + object.sacAttachmentId = message.sacAttachmentId; + if (message.sacAttachment != null && message.hasOwnProperty("sacAttachment")) + object.sacAttachment = $root.google.cloud.networksecurity.v1.SACAttachment.toObject(message.sacAttachment, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateSACAttachmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSACAttachmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSACAttachmentRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.CreateSACAttachmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSACAttachmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.CreateSACAttachmentRequest"; + }; + + return CreateSACAttachmentRequest; + })(); + + v1.DeleteSACAttachmentRequest = (function() { + + /** + * Properties of a DeleteSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @interface IDeleteSACAttachmentRequest + * @property {string|null} [name] DeleteSACAttachmentRequest name + * @property {string|null} [requestId] DeleteSACAttachmentRequest requestId + */ + + /** + * Constructs a new DeleteSACAttachmentRequest. + * @memberof google.cloud.networksecurity.v1 + * @classdesc Represents a DeleteSACAttachmentRequest. + * @implements IDeleteSACAttachmentRequest + * @constructor + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest=} [properties] Properties to set + */ + function DeleteSACAttachmentRequest(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]]; + } + + /** + * DeleteSACAttachmentRequest name. + * @member {string} name + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @instance + */ + DeleteSACAttachmentRequest.prototype.name = ""; + + /** + * DeleteSACAttachmentRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @instance + */ + DeleteSACAttachmentRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteSACAttachmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest=} [properties] Properties to set + * @returns {google.cloud.networksecurity.v1.DeleteSACAttachmentRequest} DeleteSACAttachmentRequest instance + */ + DeleteSACAttachmentRequest.create = function create(properties) { + return new DeleteSACAttachmentRequest(properties); + }; + + /** + * Encodes the specified DeleteSACAttachmentRequest message. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACAttachmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest} message DeleteSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSACAttachmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified DeleteSACAttachmentRequest message, length delimited. Does not implicitly {@link google.cloud.networksecurity.v1.DeleteSACAttachmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest} message DeleteSACAttachmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSACAttachmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSACAttachmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networksecurity.v1.DeleteSACAttachmentRequest} DeleteSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSACAttachmentRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSACAttachmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networksecurity.v1.DeleteSACAttachmentRequest} DeleteSACAttachmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSACAttachmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSACAttachmentRequest message. + * @function verify + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSACAttachmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a DeleteSACAttachmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networksecurity.v1.DeleteSACAttachmentRequest} DeleteSACAttachmentRequest + */ + DeleteSACAttachmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest) + return object; + var message = new $root.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a DeleteSACAttachmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {google.cloud.networksecurity.v1.DeleteSACAttachmentRequest} message DeleteSACAttachmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSACAttachmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.requestId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this DeleteSACAttachmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSACAttachmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSACAttachmentRequest + * @function getTypeUrl + * @memberof google.cloud.networksecurity.v1.DeleteSACAttachmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSACAttachmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networksecurity.v1.DeleteSACAttachmentRequest"; + }; + + return DeleteSACAttachmentRequest; + })(); + return v1; })(); @@ -149438,6 +154113,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -149472,6 +154148,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -149504,6 +154188,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -149555,6 +154241,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -149606,6 +154296,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -149648,6 +154343,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -149666,8 +154366,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -149675,6 +154377,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -151497,6 +156201,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -151522,6 +156227,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -151548,6 +156261,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -151588,6 +156303,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -151628,6 +156347,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -151648,6 +156372,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -151664,10 +156393,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -151697,6 +156430,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -152573,6 +157558,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -152584,6 +157570,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -152598,6 +157585,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -152624,6 +157619,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -152654,7 +157652,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -152664,6 +157662,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + 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.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -152704,6 +157725,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -152724,6 +157753,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -152740,10 +157776,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -153382,6 +158426,251 @@ return values; })(); + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + /** * LaunchStage enum. * @name google.api.LaunchStage @@ -153443,6 +158732,7 @@ * @memberof google.api * @interface IFieldInfo * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes */ /** @@ -153454,6 +158744,7 @@ * @param {google.api.IFieldInfo=} [properties] Properties to set */ function FieldInfo(properties) { + this.referencedTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -153468,6 +158759,14 @@ */ FieldInfo.prototype.format = 0; + /** + * FieldInfo referencedTypes. + * @member {Array.} referencedTypes + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.referencedTypes = $util.emptyArray; + /** * Creates a new FieldInfo instance using the specified properties. * @function create @@ -153494,6 +158793,9 @@ writer = $Writer.create(); if (message.format != null && Object.hasOwnProperty.call(message, "format")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + if (message.referencedTypes != null && message.referencedTypes.length) + for (var i = 0; i < message.referencedTypes.length; ++i) + $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -153534,6 +158836,12 @@ message.format = reader.int32(); break; } + case 2: { + if (!(message.referencedTypes && message.referencedTypes.length)) + message.referencedTypes = []; + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -153580,6 +158888,15 @@ case 4: break; } + if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { + if (!Array.isArray(message.referencedTypes)) + return "referencedTypes: array expected"; + for (var i = 0; i < message.referencedTypes.length; ++i) { + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + if (error) + return "referencedTypes." + error; + } + } return null; }; @@ -153623,6 +158940,16 @@ message.format = 4; break; } + if (object.referencedTypes) { + if (!Array.isArray(object.referencedTypes)) + throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); + message.referencedTypes = []; + for (var i = 0; i < object.referencedTypes.length; ++i) { + if (typeof object.referencedTypes[i] !== "object") + throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + } + } return message; }; @@ -153639,10 +158966,17 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.referencedTypes = []; if (options.defaults) object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; if (message.format != null && message.hasOwnProperty("format")) object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + if (message.referencedTypes && message.referencedTypes.length) { + object.referencedTypes = []; + for (var j = 0; j < message.referencedTypes.length; ++j) + object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); + } return object; }; @@ -153695,6 +159029,211 @@ return FieldInfo; })(); + api.TypeReference = (function() { + + /** + * Properties of a TypeReference. + * @memberof google.api + * @interface ITypeReference + * @property {string|null} [typeName] TypeReference typeName + */ + + /** + * Constructs a new TypeReference. + * @memberof google.api + * @classdesc Represents a TypeReference. + * @implements ITypeReference + * @constructor + * @param {google.api.ITypeReference=} [properties] Properties to set + */ + function TypeReference(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]]; + } + + /** + * TypeReference typeName. + * @member {string} typeName + * @memberof google.api.TypeReference + * @instance + */ + TypeReference.prototype.typeName = ""; + + /** + * Creates a new TypeReference instance using the specified properties. + * @function create + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference=} [properties] Properties to set + * @returns {google.api.TypeReference} TypeReference instance + */ + TypeReference.create = function create(properties) { + return new TypeReference(properties); + }; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encode + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); + return writer; + }; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.typeName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypeReference message. + * @function verify + * @memberof google.api.TypeReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypeReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + return null; + }; + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.TypeReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.TypeReference} TypeReference + */ + TypeReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.TypeReference) + return object; + var message = new $root.google.api.TypeReference(); + if (object.typeName != null) + message.typeName = String(object.typeName); + return message; + }; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.TypeReference + * @static + * @param {google.api.TypeReference} message TypeReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypeReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.typeName = ""; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + return object; + }; + + /** + * Converts this TypeReference to JSON. + * @function toJSON + * @memberof google.api.TypeReference + * @instance + * @returns {Object.} JSON object + */ + TypeReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypeReference + * @function getTypeUrl + * @memberof google.api.TypeReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.TypeReference"; + }; + + return TypeReference; + })(); + api.ResourceDescriptor = (function() { /** @@ -154626,6 +160165,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -154640,6 +160180,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -154664,6 +160205,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -154686,6 +160228,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -154736,6 +160279,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -154857,6 +160408,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -154929,6 +160483,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -155031,6 +160591,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -155085,6 +160652,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -155137,6 +160705,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -155200,6 +160775,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -155265,6 +160844,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -155321,6 +160901,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -155369,6 +160954,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -155474,6 +161060,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -155526,6 +161120,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -155618,6 +161214,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -155731,6 +161331,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -155830,6 +161439,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -155859,6 +161488,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -155904,6 +161534,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -157948,6 +163580,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -158008,6 +163641,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -158045,6 +163686,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -158107,6 +163750,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -158175,6 +163822,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -158224,6 +163880,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -158248,6 +163924,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -158268,6 +163945,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -160586,6 +166265,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo @@ -160707,6 +166387,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -160789,6 +166477,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -160892,6 +166582,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -161031,6 +166725,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -161224,6 +166923,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -161326,6 +167030,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; object[".google.api.fieldInfo"] = null; } @@ -161359,6 +167064,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -161633,6 +167340,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -161674,6 +167382,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -161773,6 +167485,488 @@ return EditionDefault; })(); + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSupport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; + return object; + }; + + /** + * Converts this FeatureSupport to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + * @returns {Object.} JSON object + */ + FeatureSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSupport + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; + }; + + return FeatureSupport; + })(); + return FieldOptions; })(); @@ -162365,6 +168559,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -162408,6 +168603,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -162446,6 +168649,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -162497,6 +168702,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -162549,6 +168758,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -162582,6 +168796,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -162614,6 +168833,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -162621,6 +168841,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -164088,6 +170310,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -164153,6 +170377,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -164189,6 +170429,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -164249,6 +170493,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -164339,6 +170591,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -164478,6 +170750,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -164501,6 +170821,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -164514,6 +170836,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -164641,6 +170967,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -164825,6 +171364,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -164842,6 +171382,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -164890,6 +171431,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -164942,6 +171487,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -165050,7 +171599,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -165077,12 +171627,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -165108,10 +171666,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -165152,8 +171712,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -165196,6 +171760,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -165208,10 +171773,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -165239,6 +171809,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -165280,10 +171854,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -165302,13 +171881,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -166523,6 +173105,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-networksecurity/protos/protos.json b/packages/google-cloud-networksecurity/protos/protos.json index c90cc437ab4a..1c6811c71251 100644 --- a/packages/google-cloud-networksecurity/protos/protos.json +++ b/packages/google-cloud-networksecurity/protos/protos.json @@ -11,7 +11,7 @@ "csharp_namespace": "Google.Cloud.NetworkSecurity.V1", "go_package": "cloud.google.com/go/networksecurity/apiv1/networksecuritypb;networksecuritypb", "java_multiple_files": true, - "java_outer_classname": "SecurityProfileGroupServiceProto", + "java_outer_classname": "SSERealmProto", "java_package": "com.google.cloud.networksecurity.v1", "php_namespace": "Google\\Cloud\\NetworkSecurity\\V1", "ruby_package": "Google::Cloud::NetworkSecurity::V1", @@ -1223,6 +1223,14 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "networkRules": { + "rule": "repeated", + "type": "AuthzRule", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "action": { "type": "AuthzAction", "id": 8, @@ -1529,6 +1537,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "snis": { + "rule": "repeated", + "type": "StringMatch", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -2528,6 +2544,24 @@ } ] }, + "ListProjectFirewallEndpoints": { + "requestType": "ListFirewallEndpointsRequest", + "responseType": "ListFirewallEndpointsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/firewallEndpoints", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/firewallEndpoints" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, "GetFirewallEndpoint": { "requestType": "GetFirewallEndpointRequest", "responseType": "FirewallEndpoint", @@ -2546,6 +2580,24 @@ } ] }, + "GetProjectFirewallEndpoint": { + "requestType": "GetFirewallEndpointRequest", + "responseType": "FirewallEndpoint", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/firewallEndpoints/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/firewallEndpoints/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, "CreateFirewallEndpoint": { "requestType": "CreateFirewallEndpointRequest", "responseType": "google.longrunning.Operation", @@ -2574,6 +2626,34 @@ } ] }, + "CreateProjectFirewallEndpoint": { + "requestType": "CreateFirewallEndpointRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/firewallEndpoints", + "(google.api.http).body": "firewall_endpoint", + "(google.api.method_signature)": "parent,firewall_endpoint,firewall_endpoint_id", + "(google.longrunning.operation_info).response_type": "FirewallEndpoint", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/firewallEndpoints", + "body": "firewall_endpoint" + } + }, + { + "(google.api.method_signature)": "parent,firewall_endpoint,firewall_endpoint_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "FirewallEndpoint", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, "DeleteFirewallEndpoint": { "requestType": "DeleteFirewallEndpointRequest", "responseType": "google.longrunning.Operation", @@ -2600,6 +2680,32 @@ } ] }, + "DeleteProjectFirewallEndpoint": { + "requestType": "DeleteFirewallEndpointRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/firewallEndpoints/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/firewallEndpoints/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, "UpdateFirewallEndpoint": { "requestType": "UpdateFirewallEndpointRequest", "responseType": "google.longrunning.Operation", @@ -2628,6 +2734,34 @@ } ] }, + "UpdateProjectFirewallEndpoint": { + "requestType": "UpdateFirewallEndpointRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{firewall_endpoint.name=projects/*/locations/*/firewallEndpoints/*}", + "(google.api.http).body": "firewall_endpoint", + "(google.api.method_signature)": "firewall_endpoint,update_mask", + "(google.longrunning.operation_info).response_type": "FirewallEndpoint", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{firewall_endpoint.name=projects/*/locations/*/firewallEndpoints/*}", + "body": "firewall_endpoint" + } + }, + { + "(google.api.method_signature)": "firewall_endpoint,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "FirewallEndpoint", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, "ListFirewallEndpointAssociations": { "requestType": "ListFirewallEndpointAssociationsRequest", "responseType": "ListFirewallEndpointAssociationsResponse", @@ -8845,7 +8979,7 @@ } } }, - "OrganizationSecurityProfileGroupService": { + "SecurityProfileGroupService": { "options": { "(google.api.default_host)": "networksecurity.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" @@ -8855,13 +8989,13 @@ "requestType": "ListSecurityProfileGroupsRequest", "responseType": "ListSecurityProfileGroupsResponse", "options": { - "(google.api.http).get": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/securityProfileGroups", "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups" + "get": "/v1/{parent=projects/*/locations/*}/securityProfileGroups" } }, { @@ -8873,13 +9007,13 @@ "requestType": "GetSecurityProfileGroupRequest", "responseType": "SecurityProfileGroup", "options": { - "(google.api.http).get": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.http).get": "/v1/{name=projects/*/locations/*/securityProfileGroups/*}", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}" + "get": "/v1/{name=projects/*/locations/*/securityProfileGroups/*}" } }, { @@ -8891,7 +9025,7 @@ "requestType": "CreateSecurityProfileGroupRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/securityProfileGroups", "(google.api.http).body": "security_profile_group", "(google.api.method_signature)": "parent,security_profile_group,security_profile_group_id", "(google.longrunning.operation_info).response_type": "SecurityProfileGroup", @@ -8900,7 +9034,7 @@ "parsedOptions": [ { "(google.api.http)": { - "post": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "post": "/v1/{parent=projects/*/locations/*}/securityProfileGroups", "body": "security_profile_group" } }, @@ -8919,7 +9053,7 @@ "requestType": "UpdateSecurityProfileGroupRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).patch": "/v1/{security_profile_group.name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.http).patch": "/v1/{security_profile_group.name=projects/*/locations/*/securityProfileGroups/*}", "(google.api.http).body": "security_profile_group", "(google.api.method_signature)": "security_profile_group,update_mask", "(google.longrunning.operation_info).response_type": "SecurityProfileGroup", @@ -8928,7 +9062,7 @@ "parsedOptions": [ { "(google.api.http)": { - "patch": "/v1/{security_profile_group.name=organizations/*/locations/*/securityProfileGroups/*}", + "patch": "/v1/{security_profile_group.name=projects/*/locations/*/securityProfileGroups/*}", "body": "security_profile_group" } }, @@ -8947,7 +9081,7 @@ "requestType": "DeleteSecurityProfileGroupRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).delete": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/securityProfileGroups/*}", "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" @@ -8955,7 +9089,7 @@ "parsedOptions": [ { "(google.api.http)": { - "delete": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}" + "delete": "/v1/{name=projects/*/locations/*/securityProfileGroups/*}" } }, { @@ -8973,13 +9107,13 @@ "requestType": "ListSecurityProfilesRequest", "responseType": "ListSecurityProfilesResponse", "options": { - "(google.api.http).get": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/securityProfiles", "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v1/{parent=organizations/*/locations/*}/securityProfiles" + "get": "/v1/{parent=projects/*/locations/*}/securityProfiles" } }, { @@ -8991,13 +9125,13 @@ "requestType": "GetSecurityProfileRequest", "responseType": "SecurityProfile", "options": { - "(google.api.http).get": "/v1/{name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.http).get": "/v1/{name=projects/*/locations/*/securityProfiles/*}", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v1/{name=organizations/*/locations/*/securityProfiles/*}" + "get": "/v1/{name=projects/*/locations/*/securityProfiles/*}" } }, { @@ -9009,7 +9143,7 @@ "requestType": "CreateSecurityProfileRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/securityProfiles", "(google.api.http).body": "security_profile", "(google.api.method_signature)": "parent,security_profile,security_profile_id", "(google.longrunning.operation_info).response_type": "SecurityProfile", @@ -9018,7 +9152,7 @@ "parsedOptions": [ { "(google.api.http)": { - "post": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "post": "/v1/{parent=projects/*/locations/*}/securityProfiles", "body": "security_profile" } }, @@ -9037,7 +9171,7 @@ "requestType": "UpdateSecurityProfileRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).patch": "/v1/{security_profile.name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.http).patch": "/v1/{security_profile.name=projects/*/locations/*/securityProfiles/*}", "(google.api.http).body": "security_profile", "(google.api.method_signature)": "security_profile,update_mask", "(google.longrunning.operation_info).response_type": "SecurityProfile", @@ -9046,7 +9180,7 @@ "parsedOptions": [ { "(google.api.http)": { - "patch": "/v1/{security_profile.name=organizations/*/locations/*/securityProfiles/*}", + "patch": "/v1/{security_profile.name=projects/*/locations/*/securityProfiles/*}", "body": "security_profile" } }, @@ -9065,7 +9199,7 @@ "requestType": "DeleteSecurityProfileRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).delete": "/v1/{name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/securityProfiles/*}", "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" @@ -9073,7 +9207,7 @@ "parsedOptions": [ { "(google.api.http)": { - "delete": "/v1/{name=organizations/*/locations/*/securityProfiles/*}" + "delete": "/v1/{name=projects/*/locations/*/securityProfiles/*}" } }, { @@ -9089,64 +9223,308 @@ } } }, - "ListSecurityProfileGroupsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, + "OrganizationSecurityProfileGroupService": { + "options": { + "(google.api.default_host)": "networksecurity.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListSecurityProfileGroups": { + "requestType": "ListSecurityProfileGroupsRequest", + "responseType": "ListSecurityProfileGroupsResponse", "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfileGroup" - } + "(google.api.http).get": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] }, - "pageSize": { - "type": "int32", - "id": 2, + "GetSecurityProfileGroup": { + "requestType": "GetSecurityProfileGroupRequest", + "responseType": "SecurityProfileGroup", "options": { - "(google.api.field_behavior)": "OPTIONAL" - } + "(google.api.http).get": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, - "pageToken": { - "type": "string", - "id": 3, + "CreateSecurityProfileGroup": { + "requestType": "CreateSecurityProfileGroupRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ListSecurityProfileGroupsResponse": { - "fields": { - "securityProfileGroups": { - "rule": "repeated", - "type": "SecurityProfileGroup", - "id": 1 + "(google.api.http).post": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "(google.api.http).body": "security_profile_group", + "(google.api.method_signature)": "parent,security_profile_group,security_profile_group_id", + "(google.longrunning.operation_info).response_type": "SecurityProfileGroup", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=organizations/*/locations/*}/securityProfileGroups", + "body": "security_profile_group" + } + }, + { + "(google.api.method_signature)": "parent,security_profile_group,security_profile_group_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SecurityProfileGroup", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetSecurityProfileGroupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfileGroup" - } - } - } - }, - "CreateSecurityProfileGroupRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, + "UpdateSecurityProfileGroup": { + "requestType": "UpdateSecurityProfileGroupRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.field_behavior)": "REQUIRED", + "(google.api.http).patch": "/v1/{security_profile_group.name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.http).body": "security_profile_group", + "(google.api.method_signature)": "security_profile_group,update_mask", + "(google.longrunning.operation_info).response_type": "SecurityProfileGroup", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{security_profile_group.name=organizations/*/locations/*/securityProfileGroups/*}", + "body": "security_profile_group" + } + }, + { + "(google.api.method_signature)": "security_profile_group,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SecurityProfileGroup", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "DeleteSecurityProfileGroup": { + "requestType": "DeleteSecurityProfileGroupRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=organizations/*/locations/*/securityProfileGroups/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "ListSecurityProfiles": { + "requestType": "ListSecurityProfilesRequest", + "responseType": "ListSecurityProfilesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=organizations/*/locations/*}/securityProfiles" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSecurityProfile": { + "requestType": "GetSecurityProfileRequest", + "responseType": "SecurityProfile", + "options": { + "(google.api.http).get": "/v1/{name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=organizations/*/locations/*/securityProfiles/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSecurityProfile": { + "requestType": "CreateSecurityProfileRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "(google.api.http).body": "security_profile", + "(google.api.method_signature)": "parent,security_profile,security_profile_id", + "(google.longrunning.operation_info).response_type": "SecurityProfile", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=organizations/*/locations/*}/securityProfiles", + "body": "security_profile" + } + }, + { + "(google.api.method_signature)": "parent,security_profile,security_profile_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SecurityProfile", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "UpdateSecurityProfile": { + "requestType": "UpdateSecurityProfileRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{security_profile.name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.http).body": "security_profile", + "(google.api.method_signature)": "security_profile,update_mask", + "(google.longrunning.operation_info).response_type": "SecurityProfile", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{security_profile.name=organizations/*/locations/*/securityProfiles/*}", + "body": "security_profile" + } + }, + { + "(google.api.method_signature)": "security_profile,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SecurityProfile", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "DeleteSecurityProfile": { + "requestType": "DeleteSecurityProfileRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=organizations/*/locations/*/securityProfiles/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=organizations/*/locations/*/securityProfiles/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + } + } + }, + "ListSecurityProfileGroupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfileGroup" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSecurityProfileGroupsResponse": { + "fields": { + "securityProfileGroups": { + "rule": "repeated", + "type": "SecurityProfileGroup", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetSecurityProfileGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfileGroup" + } + } + } + }, + "CreateSecurityProfileGroupRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfileGroup" } }, @@ -9157,60 +9535,651 @@ "(google.api.field_behavior)": "REQUIRED" } }, - "securityProfileGroup": { - "type": "SecurityProfileGroup", - "id": 3, + "securityProfileGroup": { + "type": "SecurityProfileGroup", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateSecurityProfileGroupRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "securityProfileGroup": { + "type": "SecurityProfileGroup", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteSecurityProfileGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfileGroup" + } + }, + "etag": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSecurityProfilesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfile" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSecurityProfilesResponse": { + "fields": { + "securityProfiles": { + "rule": "repeated", + "type": "SecurityProfile", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetSecurityProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfile" + } + } + } + }, + "CreateSecurityProfileRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfile" + } + }, + "securityProfileId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "securityProfile": { + "type": "SecurityProfile", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateSecurityProfileRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "securityProfile": { + "type": "SecurityProfile", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteSecurityProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfile" + } + }, + "etag": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SSERealmService": { + "options": { + "(google.api.default_host)": "networksecurity.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListSACRealms": { + "requestType": "ListSACRealmsRequest", + "responseType": "ListSACRealmsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/sacRealms", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/sacRealms" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSACRealm": { + "requestType": "GetSACRealmRequest", + "responseType": "SACRealm", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/sacRealms/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/sacRealms/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSACRealm": { + "requestType": "CreateSACRealmRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/sacRealms", + "(google.api.http).body": "sac_realm", + "(google.api.method_signature)": "parent,sac_realm,sac_realm_id", + "(google.longrunning.operation_info).response_type": "SACRealm", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/sacRealms", + "body": "sac_realm" + } + }, + { + "(google.api.method_signature)": "parent,sac_realm,sac_realm_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SACRealm", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "DeleteSACRealm": { + "requestType": "DeleteSACRealmRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/sacRealms/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/sacRealms/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "ListSACAttachments": { + "requestType": "ListSACAttachmentsRequest", + "responseType": "ListSACAttachmentsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/sacAttachments", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/sacAttachments" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSACAttachment": { + "requestType": "GetSACAttachmentRequest", + "responseType": "SACAttachment", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/sacAttachments/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/sacAttachments/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSACAttachment": { + "requestType": "CreateSACAttachmentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/sacAttachments", + "(google.api.http).body": "sac_attachment", + "(google.api.method_signature)": "parent,sac_attachment,sac_attachment_id", + "(google.longrunning.operation_info).response_type": "SACAttachment", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/sacAttachments", + "body": "sac_attachment" + } + }, + { + "(google.api.method_signature)": "parent,sac_attachment,sac_attachment_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SACAttachment", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + }, + "DeleteSACAttachment": { + "requestType": "DeleteSACAttachmentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/sacAttachments/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/sacAttachments/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networksecurity.v1.OperationMetadata" + } + } + ] + } + } + }, + "SACRealm": { + "options": { + "(google.api.resource).type": "networksecurity.googleapis.com/SACRealm", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/sacRealms/{sac_realm}", + "(google.api.resource).plural": "sacRealms", + "(google.api.resource).singular": "sacRealm" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "securityService": { + "type": "SecurityService", + "id": 5, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "pairingKey": { + "type": "PairingKey", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "PairingKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "SecurityService": { + "values": { + "SECURITY_SERVICE_UNSPECIFIED": 0, + "PALO_ALTO_PRISMA_ACCESS": 1 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING_PARTNER_ATTACHMENT": 7, + "PARTNER_ATTACHED": 1, + "PARTNER_DETACHED": 2, + "KEY_EXPIRED": 3 + } + } + } + }, + "ListSACRealmsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SACRealm" + } + }, + "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" + } + } + } + }, + "ListSACRealmsResponse": { + "fields": { + "sacRealms": { + "rule": "repeated", + "type": "SACRealm", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetSACRealmRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SACRealm" + } + } + } + }, + "CreateSACRealmRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SACRealm" + } + }, + "sacRealmId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sacRealm": { + "type": "SACRealm", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_info).format": "UUID4", + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteSACRealmRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SACRealm" + } + }, + "requestId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_info).format": "UUID4", + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SACAttachment": { + "options": { + "(google.api.resource).type": "networksecurity.googleapis.com/SACAttachment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/sacAttachments/{sac_attachment}", + "(google.api.resource).plural": "sacAttachments", + "(google.api.resource).singular": "sacAttachment" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sacRealm": { + "type": "string", + "id": 5, "options": { "(google.api.field_behavior)": "REQUIRED" } - } - } - }, - "UpdateSecurityProfileGroupRequest": { - "fields": { - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 1, + }, + "nccGateway": { + "type": "string", + "id": 6, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "securityProfileGroup": { - "type": "SecurityProfileGroup", - "id": 2, + "state": { + "type": "State", + "id": 10, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OUTPUT_ONLY" } } - } - }, - "DeleteSecurityProfileGroupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfileGroup" - } - }, - "etag": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING_PARTNER_ATTACHMENT": 1, + "PARTNER_ATTACHED": 2, + "PARTNER_DETACHED": 3 } } } }, - "ListSecurityProfilesRequest": { + "ListSACAttachmentsRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfile" + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SACAttachment" } }, "pageSize": { @@ -9226,92 +10195,102 @@ "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" + } } } }, - "ListSecurityProfilesResponse": { + "ListSACAttachmentsResponse": { "fields": { - "securityProfiles": { + "sacAttachments": { "rule": "repeated", - "type": "SecurityProfile", + "type": "SACAttachment", "id": 1 }, "nextPageToken": { "type": "string", "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 } } }, - "GetSecurityProfileRequest": { + "GetSACAttachmentRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfile" + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SACAttachment" } } } }, - "CreateSecurityProfileRequest": { + "CreateSACAttachmentRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SecurityProfile" + "(google.api.resource_reference).child_type": "networksecurity.googleapis.com/SACAttachment" } }, - "securityProfileId": { + "sacAttachmentId": { "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "securityProfile": { - "type": "SecurityProfile", + "sacAttachment": { + "type": "SACAttachment", "id": 3, "options": { "(google.api.field_behavior)": "REQUIRED" } - } - } - }, - "UpdateSecurityProfileRequest": { - "fields": { - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } }, - "securityProfile": { - "type": "SecurityProfile", - "id": 2, + "requestId": { + "type": "string", + "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_info).format": "UUID4", + "(google.api.field_behavior)": "OPTIONAL" } } } }, - "DeleteSecurityProfileRequest": { + "DeleteSACAttachmentRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networksecurity.googleapis.com/SecurityProfile" + "(google.api.resource_reference).type": "networksecurity.googleapis.com/SACAttachment" } }, - "etag": { + "requestId": { "type": "string", "id": 2, "options": { + "(google.api.field_info).format": "UUID4", "(google.api.field_behavior)": "OPTIONAL" } } @@ -20797,8 +21776,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -20922,6 +21900,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -21062,6 +22044,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -21119,6 +22123,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -21180,6 +22189,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -21224,6 +22246,11 @@ "format": { "type": "Format", "id": 1 + }, + "referencedTypes": { + "rule": "repeated", + "type": "TypeReference", + "id": 2 } }, "nested": { @@ -21238,6 +22265,14 @@ } } }, + "TypeReference": { + "fields": { + "typeName": { + "type": "string", + "id": 1 + } + } + }, "resourceReference": { "type": "google.api.ResourceReference", "id": 1055, @@ -21336,12 +22371,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -21380,6 +22422,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -21468,6 +22515,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -21693,6 +22744,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -21743,7 +22798,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -21907,6 +22969,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -22042,7 +23105,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -22070,6 +23134,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -22139,6 +23207,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -22227,6 +23315,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -22369,6 +23461,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -22379,6 +23472,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -22389,6 +23483,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -22399,6 +23494,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -22409,7 +23505,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -22419,27 +23516,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -22484,7 +23592,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -22499,6 +23613,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -22526,11 +23667,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -22543,6 +23699,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -22628,6 +23790,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -22686,6 +23856,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_project_firewall_endpoint.js b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_project_firewall_endpoint.js new file mode 100644 index 000000000000..8edda2419da2 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.create_project_firewall_endpoint.js @@ -0,0 +1,88 @@ +// Copyright 2026 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, firewallEndpointId, firewallEndpoint) { + // [START networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_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. Value for parent. + */ + // const parent = 'abc123' + /** + * Required. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_id from the method_signature of Create RPC. + */ + // const firewallEndpointId = 'abc123' + /** + * Required. The resource being created + */ + // const firewallEndpoint = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {FirewallActivationClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new FirewallActivationClient(); + + async function callCreateProjectFirewallEndpoint() { + // Construct request + const request = { + parent, + firewallEndpointId, + firewallEndpoint, + }; + + // Run request + const [operation] = await networksecurityClient.createProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateProjectFirewallEndpoint(); + // [END networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_project_firewall_endpoint.js b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_project_firewall_endpoint.js new file mode 100644 index 000000000000..e4939d133488 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.delete_project_firewall_endpoint.js @@ -0,0 +1,76 @@ +// Copyright 2026 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 networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_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. Name of the resource + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {FirewallActivationClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new FirewallActivationClient(); + + async function callDeleteProjectFirewallEndpoint() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networksecurityClient.deleteProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProjectFirewallEndpoint(); + // [END networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_project_firewall_endpoint.js b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_project_firewall_endpoint.js new file mode 100644 index 000000000000..1fbb935f457b --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.get_project_firewall_endpoint.js @@ -0,0 +1,61 @@ +// Copyright 2026 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 networksecurity_v1_generated_FirewallActivation_GetProjectFirewallEndpoint_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. Name of the resource + */ + // const name = 'abc123' + + // Imports the Networksecurity library + const {FirewallActivationClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new FirewallActivationClient(); + + async function callGetProjectFirewallEndpoint() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networksecurityClient.getProjectFirewallEndpoint(request); + console.log(response); + } + + callGetProjectFirewallEndpoint(); + // [END networksecurity_v1_generated_FirewallActivation_GetProjectFirewallEndpoint_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_project_firewall_endpoints.js b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_project_firewall_endpoints.js new file mode 100644 index 000000000000..7a62aef8ad8e --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.list_project_firewall_endpoints.js @@ -0,0 +1,80 @@ +// Copyright 2026 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 networksecurity_v1_generated_FirewallActivation_ListProjectFirewallEndpoints_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. Parent value for ListEndpointsRequest + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. Filtering results + */ + // const filter = 'abc123' + /** + * Hint for how to order the results + */ + // const orderBy = 'abc123' + + // Imports the Networksecurity library + const {FirewallActivationClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new FirewallActivationClient(); + + async function callListProjectFirewallEndpoints() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networksecurityClient.listProjectFirewallEndpointsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProjectFirewallEndpoints(); + // [END networksecurity_v1_generated_FirewallActivation_ListProjectFirewallEndpoints_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_project_firewall_endpoint.js b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_project_firewall_endpoint.js new file mode 100644 index 000000000000..e3708752ae07 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/firewall_activation.update_project_firewall_endpoint.js @@ -0,0 +1,85 @@ +// Copyright 2026 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, firewallEndpoint) { + // [START networksecurity_v1_generated_FirewallActivation_UpdateProjectFirewallEndpoint_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. Field mask is used to specify the fields to be overwritten in the + * Endpoint resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The resource being updated + */ + // const firewallEndpoint = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {FirewallActivationClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new FirewallActivationClient(); + + async function callUpdateProjectFirewallEndpoint() { + // Construct request + const request = { + updateMask, + firewallEndpoint, + }; + + // Run request + const [operation] = await networksecurityClient.updateProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateProjectFirewallEndpoint(); + // [END networksecurity_v1_generated_FirewallActivation_UpdateProjectFirewallEndpoint_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_attachment.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_attachment.js new file mode 100644 index 000000000000..d9932b2b8e3f --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_attachment.js @@ -0,0 +1,94 @@ +// Copyright 2026 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, sacAttachmentId, sacAttachment) { + // [START networksecurity_v1_generated_SSERealmService_CreateSACAttachment_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, in the form + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. ID of the created attachment. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + */ + // const sacAttachmentId = 'abc123' + /** + * Required. The resource being created. + */ + // const sacAttachment = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callCreateSACAttachment() { + // Construct request + const request = { + parent, + sacAttachmentId, + sacAttachment, + }; + + // Run request + const [operation] = await networksecurityClient.createSACAttachment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSACAttachment(); + // [END networksecurity_v1_generated_SSERealmService_CreateSACAttachment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_realm.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_realm.js new file mode 100644 index 000000000000..7112409a5a4e --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.create_s_a_c_realm.js @@ -0,0 +1,93 @@ +// Copyright 2026 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, sacRealmId, sacRealm) { + // [START networksecurity_v1_generated_SSERealmService_CreateSACRealm_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, in the form `projects/{project}/locations/global`. + */ + // const parent = 'abc123' + /** + * Required. ID of the created realm. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + */ + // const sacRealmId = 'abc123' + /** + * Required. The resource being created. + */ + // const sacRealm = {} + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callCreateSACRealm() { + // Construct request + const request = { + parent, + sacRealmId, + sacRealm, + }; + + // Run request + const [operation] = await networksecurityClient.createSACRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSACRealm(); + // [END networksecurity_v1_generated_SSERealmService_CreateSACRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_attachment.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_attachment.js new file mode 100644 index 000000000000..6dd471c7f678 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_attachment.js @@ -0,0 +1,77 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_DeleteSACAttachment_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. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callDeleteSACAttachment() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networksecurityClient.deleteSACAttachment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSACAttachment(); + // [END networksecurity_v1_generated_SSERealmService_DeleteSACAttachment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_realm.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_realm.js new file mode 100644 index 000000000000..c044e3c1c2a7 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.delete_s_a_c_realm.js @@ -0,0 +1,77 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_DeleteSACRealm_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. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + */ + // const name = 'abc123' + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callDeleteSACRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networksecurityClient.deleteSACRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSACRealm(); + // [END networksecurity_v1_generated_SSERealmService_DeleteSACRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_attachment.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_attachment.js new file mode 100644 index 000000000000..32f50decfce1 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_attachment.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_GetSACAttachment_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. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + */ + // const name = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callGetSACAttachment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networksecurityClient.getSACAttachment(request); + console.log(response); + } + + callGetSACAttachment(); + // [END networksecurity_v1_generated_SSERealmService_GetSACAttachment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_realm.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_realm.js new file mode 100644 index 000000000000..852769fdfc52 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.get_s_a_c_realm.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_GetSACRealm_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. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + */ + // const name = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callGetSACRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networksecurityClient.getSACRealm(request); + console.log(response); + } + + callGetSACRealm(); + // [END networksecurity_v1_generated_SSERealmService_GetSACRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_attachments.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_attachments.js new file mode 100644 index 000000000000..7563eac9e97f --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_attachments.js @@ -0,0 +1,81 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_ListSACAttachments_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, in the form + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. An expression that filters the list of results. + */ + // const filter = 'abc123' + /** + * Optional. Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callListSACAttachments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networksecurityClient.listSACAttachmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSACAttachments(); + // [END networksecurity_v1_generated_SSERealmService_ListSACAttachments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_realms.js b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_realms.js new file mode 100644 index 000000000000..f432823ca468 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/s_s_e_realm_service.list_s_a_c_realms.js @@ -0,0 +1,80 @@ +// Copyright 2026 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 networksecurity_v1_generated_SSERealmService_ListSACRealms_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, in the form `projects/{project}/locations/global`. + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. An expression that filters the list of results. + */ + // const filter = 'abc123' + /** + * Optional. Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networksecurity library + const {SSERealmServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SSERealmServiceClient(); + + async function callListSACRealms() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networksecurityClient.listSACRealmsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSACRealms(); + // [END networksecurity_v1_generated_SSERealmService_ListSACRealms_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile.js new file mode 100644 index 000000000000..744fa6a7f56d --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile.js @@ -0,0 +1,76 @@ +// Copyright 2026 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, securityProfileId, securityProfile) { + // [START networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfile_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 SecurityProfile. Must be in the format + * `projects|organizations/* /locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. Short name of the SecurityProfile resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "security_profile1". + */ + // const securityProfileId = 'abc123' + /** + * Required. SecurityProfile resource to be created. + */ + // const securityProfile = {} + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callCreateSecurityProfile() { + // Construct request + const request = { + parent, + securityProfileId, + securityProfile, + }; + + // Run request + const [operation] = await networksecurityClient.createSecurityProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSecurityProfile(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile_group.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile_group.js new file mode 100644 index 000000000000..14a08610fa59 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.create_security_profile_group.js @@ -0,0 +1,76 @@ +// Copyright 2026 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, securityProfileGroupId, securityProfileGroup) { + // [START networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfileGroup_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 SecurityProfileGroup. Must be in the + * format `projects|organizations/* /locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. Short name of the SecurityProfileGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "security_profile_group1". + */ + // const securityProfileGroupId = 'abc123' + /** + * Required. SecurityProfileGroup resource to be created. + */ + // const securityProfileGroup = {} + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callCreateSecurityProfileGroup() { + // Construct request + const request = { + parent, + securityProfileGroupId, + securityProfileGroup, + }; + + // Run request + const [operation] = await networksecurityClient.createSecurityProfileGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSecurityProfileGroup(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfileGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile.js new file mode 100644 index 000000000000..330f52299ccf --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfile_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. A name of the SecurityProfile to delete. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + */ + // const name = 'abc123' + /** + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + */ + // const etag = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callDeleteSecurityProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networksecurityClient.deleteSecurityProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSecurityProfile(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile_group.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile_group.js new file mode 100644 index 000000000000..32c682ffff20 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.delete_security_profile_group.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfileGroup_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. A name of the SecurityProfileGroup to delete. Must be in the + * format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + */ + // const name = 'abc123' + /** + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + */ + // const etag = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callDeleteSecurityProfileGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networksecurityClient.deleteSecurityProfileGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSecurityProfileGroup(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfileGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile.js new file mode 100644 index 000000000000..05b318ffa0cc --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfile_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. A name of the SecurityProfile to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + */ + // const name = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callGetSecurityProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networksecurityClient.getSecurityProfile(request); + console.log(response); + } + + callGetSecurityProfile(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile_group.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile_group.js new file mode 100644 index 000000000000..70e4e82fd12a --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.get_security_profile_group.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfileGroup_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. A name of the SecurityProfileGroup to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + */ + // const name = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callGetSecurityProfileGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networksecurityClient.getSecurityProfileGroup(request); + console.log(response); + } + + callGetSecurityProfileGroup(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfileGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profile_groups.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profile_groups.js new file mode 100644 index 000000000000..3f7a98854073 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profile_groups.js @@ -0,0 +1,76 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfileGroups_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 project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of SecurityProfileGroups to return per call. + */ + // const pageSize = 1234 + /** + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callListSecurityProfileGroups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networksecurityClient.listSecurityProfileGroupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSecurityProfileGroups(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfileGroups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profiles.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profiles.js new file mode 100644 index 000000000000..00886775e821 --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.list_security_profiles.js @@ -0,0 +1,76 @@ +// Copyright 2026 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 networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfiles_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 project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of SecurityProfiles to return per call. + */ + // const pageSize = 1234 + /** + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callListSecurityProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networksecurityClient.listSecurityProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSecurityProfiles(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile.js new file mode 100644 index 000000000000..eacfec32479b --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile.js @@ -0,0 +1,70 @@ +// Copyright 2026 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, securityProfile) { + // [START networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfile_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. Field mask is used to specify the fields to be overwritten in the + * SecurityProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. Updated SecurityProfile resource. + */ + // const securityProfile = {} + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callUpdateSecurityProfile() { + // Construct request + const request = { + updateMask, + securityProfile, + }; + + // Run request + const [operation] = await networksecurityClient.updateSecurityProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSecurityProfile(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile_group.js b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile_group.js new file mode 100644 index 000000000000..8d3d96941c6d --- /dev/null +++ b/packages/google-cloud-networksecurity/samples/generated/v1/security_profile_group_service.update_security_profile_group.js @@ -0,0 +1,70 @@ +// Copyright 2026 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, securityProfileGroup) { + // [START networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfileGroup_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. Field mask is used to specify the fields to be overwritten in the + * SecurityProfileGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. Updated SecurityProfileGroup resource. + */ + // const securityProfileGroup = {} + + // Imports the Networksecurity library + const {SecurityProfileGroupServiceClient} = require('@google-cloud/network-security').v1; + + // Instantiates a client + const networksecurityClient = new SecurityProfileGroupServiceClient(); + + async function callUpdateSecurityProfileGroup() { + // Construct request + const request = { + updateMask, + securityProfileGroup, + }; + + // Run request + const [operation] = await networksecurityClient.updateSecurityProfileGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSecurityProfileGroup(); + // [END networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfileGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networksecurity/samples/generated/v1/snippet_metadata_google.cloud.networksecurity.v1.json b/packages/google-cloud-networksecurity/samples/generated/v1/snippet_metadata_google.cloud.networksecurity.v1.json index 946d7a5b84ae..676b6b904c4e 100644 --- a/packages/google-cloud-networksecurity/samples/generated/v1/snippet_metadata_google.cloud.networksecurity.v1.json +++ b/packages/google-cloud-networksecurity/samples/generated/v1/snippet_metadata_google.cloud.networksecurity.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-networksecurity", - "version": "3.4.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { @@ -715,6 +715,62 @@ } } }, + { + "regionTag": "networksecurity_v1_generated_FirewallActivation_ListProjectFirewallEndpoints_async", + "title": "AddressGroupService listProjectFirewallEndpoints Sample", + "origin": "API_DEFINITION", + "description": " Lists FirewallEndpoints in a given project and location.", + "canonical": true, + "file": "firewall_activation.list_project_firewall_endpoints.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProjectFirewallEndpoints", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.ListProjectFirewallEndpoints", + "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.networksecurity.v1.ListFirewallEndpointsResponse", + "client": { + "shortName": "FirewallActivationClient", + "fullName": "google.cloud.networksecurity.v1.FirewallActivationClient" + }, + "method": { + "shortName": "ListProjectFirewallEndpoints", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.ListProjectFirewallEndpoints", + "service": { + "shortName": "FirewallActivation", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation" + } + } + } + }, { "regionTag": "networksecurity_v1_generated_FirewallActivation_GetFirewallEndpoint_async", "title": "AddressGroupService getFirewallEndpoint Sample", @@ -755,6 +811,46 @@ } } }, + { + "regionTag": "networksecurity_v1_generated_FirewallActivation_GetProjectFirewallEndpoint_async", + "title": "AddressGroupService getProjectFirewallEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single project Endpoint.", + "canonical": true, + "file": "firewall_activation.get_project_firewall_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.GetProjectFirewallEndpoint", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.FirewallEndpoint", + "client": { + "shortName": "FirewallActivationClient", + "fullName": "google.cloud.networksecurity.v1.FirewallActivationClient" + }, + "method": { + "shortName": "GetProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.GetProjectFirewallEndpoint", + "service": { + "shortName": "FirewallActivation", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation" + } + } + } + }, { "regionTag": "networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpoint_async", "title": "AddressGroupService createFirewallEndpoint Sample", @@ -807,6 +903,58 @@ } } }, + { + "regionTag": "networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_async", + "title": "AddressGroupService createProjectFirewallEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Creates a new FirewallEndpoint in a given project and location.", + "canonical": true, + "file": "firewall_activation.create_project_firewall_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.CreateProjectFirewallEndpoint", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "firewall_endpoint_id", + "type": "TYPE_STRING" + }, + { + "name": "firewall_endpoint", + "type": ".google.cloud.networksecurity.v1.FirewallEndpoint" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FirewallActivationClient", + "fullName": "google.cloud.networksecurity.v1.FirewallActivationClient" + }, + "method": { + "shortName": "CreateProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.CreateProjectFirewallEndpoint", + "service": { + "shortName": "FirewallActivation", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation" + } + } + } + }, { "regionTag": "networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpoint_async", "title": "AddressGroupService deleteFirewallEndpoint Sample", @@ -851,6 +999,50 @@ } } }, + { + "regionTag": "networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_async", + "title": "AddressGroupService deleteProjectFirewallEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single project Endpoint.", + "canonical": true, + "file": "firewall_activation.delete_project_firewall_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.DeleteProjectFirewallEndpoint", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FirewallActivationClient", + "fullName": "google.cloud.networksecurity.v1.FirewallActivationClient" + }, + "method": { + "shortName": "DeleteProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.DeleteProjectFirewallEndpoint", + "service": { + "shortName": "FirewallActivation", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation" + } + } + } + }, { "regionTag": "networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpoint_async", "title": "AddressGroupService updateFirewallEndpoint Sample", @@ -899,6 +1091,54 @@ } } }, + { + "regionTag": "networksecurity_v1_generated_FirewallActivation_UpdateProjectFirewallEndpoint_async", + "title": "AddressGroupService updateProjectFirewallEndpoint Sample", + "origin": "API_DEFINITION", + "description": " Update a single project Endpoint.", + "canonical": true, + "file": "firewall_activation.update_project_firewall_endpoint.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.UpdateProjectFirewallEndpoint", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "firewall_endpoint", + "type": ".google.cloud.networksecurity.v1.FirewallEndpoint" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FirewallActivationClient", + "fullName": "google.cloud.networksecurity.v1.FirewallActivationClient" + }, + "method": { + "shortName": "UpdateProjectFirewallEndpoint", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation.UpdateProjectFirewallEndpoint", + "service": { + "shortName": "FirewallActivation", + "fullName": "google.cloud.networksecurity.v1.FirewallActivation" + } + } + } + }, { "regionTag": "networksecurity_v1_generated_FirewallActivation_ListFirewallEndpointAssociations_async", "title": "AddressGroupService listFirewallEndpointAssociations Sample", @@ -5946,6 +6186,838 @@ } } } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfileGroups_async", + "title": "AddressGroupService listSecurityProfileGroups Sample", + "origin": "API_DEFINITION", + "description": " Lists SecurityProfileGroups in a given project and location.", + "canonical": true, + "file": "security_profile_group_service.list_security_profile_groups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSecurityProfileGroups", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfileGroups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.ListSecurityProfileGroupsResponse", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "ListSecurityProfileGroups", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfileGroups", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfileGroup_async", + "title": "AddressGroupService getSecurityProfileGroup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single SecurityProfileGroup.", + "canonical": true, + "file": "security_profile_group_service.get_security_profile_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.SecurityProfileGroup", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "GetSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfileGroup", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfileGroup_async", + "title": "AddressGroupService createSecurityProfileGroup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new SecurityProfileGroup in a given project and location.", + "canonical": true, + "file": "security_profile_group_service.create_security_profile_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileGroup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "security_profile_group_id", + "type": "TYPE_STRING" + }, + { + "name": "security_profile_group", + "type": ".google.cloud.networksecurity.v1.SecurityProfileGroup" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "CreateSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfileGroup", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfileGroup_async", + "title": "AddressGroupService updateSecurityProfileGroup Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single SecurityProfileGroup.", + "canonical": true, + "file": "security_profile_group_service.update_security_profile_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileGroup", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "security_profile_group", + "type": ".google.cloud.networksecurity.v1.SecurityProfileGroup" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "UpdateSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfileGroup", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfileGroup_async", + "title": "AddressGroupService deleteSecurityProfileGroup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single SecurityProfileGroup.", + "canonical": true, + "file": "security_profile_group_service.delete_security_profile_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "DeleteSecurityProfileGroup", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfileGroup", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfiles_async", + "title": "AddressGroupService listSecurityProfiles Sample", + "origin": "API_DEFINITION", + "description": " Lists SecurityProfiles in a given project and location.", + "canonical": true, + "file": "security_profile_group_service.list_security_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSecurityProfiles", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.ListSecurityProfilesResponse", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "ListSecurityProfiles", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.ListSecurityProfiles", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfile_async", + "title": "AddressGroupService getSecurityProfile Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single SecurityProfile.", + "canonical": true, + "file": "security_profile_group_service.get_security_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.SecurityProfile", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "GetSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.GetSecurityProfile", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfile_async", + "title": "AddressGroupService createSecurityProfile Sample", + "origin": "API_DEFINITION", + "description": " Creates a new SecurityProfile in a given project and location.", + "canonical": true, + "file": "security_profile_group_service.create_security_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "security_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "security_profile", + "type": ".google.cloud.networksecurity.v1.SecurityProfile" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "CreateSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.CreateSecurityProfile", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfile_async", + "title": "AddressGroupService updateSecurityProfile Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single SecurityProfile.", + "canonical": true, + "file": "security_profile_group_service.update_security_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfile", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "security_profile", + "type": ".google.cloud.networksecurity.v1.SecurityProfile" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "UpdateSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.UpdateSecurityProfile", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfile_async", + "title": "AddressGroupService deleteSecurityProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single SecurityProfile.", + "canonical": true, + "file": "security_profile_group_service.delete_security_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityProfileGroupServiceClient", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupServiceClient" + }, + "method": { + "shortName": "DeleteSecurityProfile", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService.DeleteSecurityProfile", + "service": { + "shortName": "SecurityProfileGroupService", + "fullName": "google.cloud.networksecurity.v1.SecurityProfileGroupService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_ListSACRealms_async", + "title": "AddressGroupService listSACRealms Sample", + "origin": "API_DEFINITION", + "description": " Lists SACRealms in a given project.", + "canonical": true, + "file": "s_s_e_realm_service.list_s_a_c_realms.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSACRealms", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.ListSACRealms", + "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.networksecurity.v1.ListSACRealmsResponse", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "ListSACRealms", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.ListSACRealms", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_GetSACRealm_async", + "title": "AddressGroupService getSACRealm Sample", + "origin": "API_DEFINITION", + "description": " Returns the specified realm.", + "canonical": true, + "file": "s_s_e_realm_service.get_s_a_c_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.GetSACRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.SACRealm", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "GetSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.GetSACRealm", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_CreateSACRealm_async", + "title": "AddressGroupService createSACRealm Sample", + "origin": "API_DEFINITION", + "description": " Creates a new SACRealm in a given project.", + "canonical": true, + "file": "s_s_e_realm_service.create_s_a_c_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.CreateSACRealm", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "sac_realm_id", + "type": "TYPE_STRING" + }, + { + "name": "sac_realm", + "type": ".google.cloud.networksecurity.v1.SACRealm" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "CreateSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.CreateSACRealm", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_DeleteSACRealm_async", + "title": "AddressGroupService deleteSACRealm Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified realm.", + "canonical": true, + "file": "s_s_e_realm_service.delete_s_a_c_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.DeleteSACRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "DeleteSACRealm", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.DeleteSACRealm", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_ListSACAttachments_async", + "title": "AddressGroupService listSACAttachments Sample", + "origin": "API_DEFINITION", + "description": " Lists SACAttachments in a given project and location.", + "canonical": true, + "file": "s_s_e_realm_service.list_s_a_c_attachments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSACAttachments", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.ListSACAttachments", + "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.networksecurity.v1.ListSACAttachmentsResponse", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "ListSACAttachments", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.ListSACAttachments", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_GetSACAttachment_async", + "title": "AddressGroupService getSACAttachment Sample", + "origin": "API_DEFINITION", + "description": " Returns the specified attachment.", + "canonical": true, + "file": "s_s_e_realm_service.get_s_a_c_attachment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.GetSACAttachment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networksecurity.v1.SACAttachment", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "GetSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.GetSACAttachment", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_CreateSACAttachment_async", + "title": "AddressGroupService createSACAttachment Sample", + "origin": "API_DEFINITION", + "description": " Creates a new SACAttachment in a given project and location.", + "canonical": true, + "file": "s_s_e_realm_service.create_s_a_c_attachment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.CreateSACAttachment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "sac_attachment_id", + "type": "TYPE_STRING" + }, + { + "name": "sac_attachment", + "type": ".google.cloud.networksecurity.v1.SACAttachment" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "CreateSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.CreateSACAttachment", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } + }, + { + "regionTag": "networksecurity_v1_generated_SSERealmService_DeleteSACAttachment_async", + "title": "AddressGroupService deleteSACAttachment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified attachment.", + "canonical": true, + "file": "s_s_e_realm_service.delete_s_a_c_attachment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.DeleteSACAttachment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SSERealmServiceClient", + "fullName": "google.cloud.networksecurity.v1.SSERealmServiceClient" + }, + "method": { + "shortName": "DeleteSACAttachment", + "fullName": "google.cloud.networksecurity.v1.SSERealmService.DeleteSACAttachment", + "service": { + "shortName": "SSERealmService", + "fullName": "google.cloud.networksecurity.v1.SSERealmService" + } + } + } } ] } diff --git a/packages/google-cloud-networksecurity/samples/generated/v1alpha1/snippet_metadata_google.cloud.networksecurity.v1alpha1.json b/packages/google-cloud-networksecurity/samples/generated/v1alpha1/snippet_metadata_google.cloud.networksecurity.v1alpha1.json index 5748b8e0e173..dd6c359478c0 100644 --- a/packages/google-cloud-networksecurity/samples/generated/v1alpha1/snippet_metadata_google.cloud.networksecurity.v1alpha1.json +++ b/packages/google-cloud-networksecurity/samples/generated/v1alpha1/snippet_metadata_google.cloud.networksecurity.v1alpha1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-networksecurity", - "version": "3.4.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-networksecurity/samples/generated/v1beta1/snippet_metadata_google.cloud.networksecurity.v1beta1.json b/packages/google-cloud-networksecurity/samples/generated/v1beta1/snippet_metadata_google.cloud.networksecurity.v1beta1.json index 688c7239508a..ed83461dc4bf 100644 --- a/packages/google-cloud-networksecurity/samples/generated/v1beta1/snippet_metadata_google.cloud.networksecurity.v1beta1.json +++ b/packages/google-cloud-networksecurity/samples/generated/v1beta1/snippet_metadata_google.cloud.networksecurity.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-networksecurity", - "version": "3.4.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-networksecurity/src/v1/address_group_service_client.ts b/packages/google-cloud-networksecurity/src/v1/address_group_service_client.ts index ba46c54c2dd8..9bfcb973fa87 100644 --- a/packages/google-cloud-networksecurity/src/v1/address_group_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/address_group_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +59,7 @@ export class AddressGroupServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -59,12 +72,12 @@ export class AddressGroupServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - addressGroupServiceStub?: Promise<{[name: string]: Function}>; + addressGroupServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of AddressGroupServiceClient. @@ -105,21 +118,42 @@ export class AddressGroupServiceClient { * const client = new AddressGroupServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AddressGroupServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -144,7 +178,7 @@ export class AddressGroupServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,18 +191,14 @@ export class AddressGroupServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -190,91 +220,106 @@ export class AddressGroupServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -282,10 +327,16 @@ export class AddressGroupServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAddressGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'addressGroups'), - listAddressGroupReferences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'addressGroupReferences') + listAddressGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'addressGroups', + ), + listAddressGroupReferences: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'addressGroupReferences', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -294,78 +345,215 @@ export class AddressGroupServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createAddressGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const createAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateAddressGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const updateAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const addAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const addAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const removeAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const removeAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const cloneAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const cloneAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAddressGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createAddressGroupResponse.decode.bind(createAddressGroupResponse), - createAddressGroupMetadata.decode.bind(createAddressGroupMetadata)), + createAddressGroupMetadata.decode.bind(createAddressGroupMetadata), + ), updateAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAddressGroupResponse.decode.bind(updateAddressGroupResponse), - updateAddressGroupMetadata.decode.bind(updateAddressGroupMetadata)), + updateAddressGroupMetadata.decode.bind(updateAddressGroupMetadata), + ), addAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, addAddressGroupItemsResponse.decode.bind(addAddressGroupItemsResponse), - addAddressGroupItemsMetadata.decode.bind(addAddressGroupItemsMetadata)), + addAddressGroupItemsMetadata.decode.bind(addAddressGroupItemsMetadata), + ), removeAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - removeAddressGroupItemsResponse.decode.bind(removeAddressGroupItemsResponse), - removeAddressGroupItemsMetadata.decode.bind(removeAddressGroupItemsMetadata)), + removeAddressGroupItemsResponse.decode.bind( + removeAddressGroupItemsResponse, + ), + removeAddressGroupItemsMetadata.decode.bind( + removeAddressGroupItemsMetadata, + ), + ), cloneAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - cloneAddressGroupItemsResponse.decode.bind(cloneAddressGroupItemsResponse), - cloneAddressGroupItemsMetadata.decode.bind(cloneAddressGroupItemsMetadata)), + cloneAddressGroupItemsResponse.decode.bind( + cloneAddressGroupItemsResponse, + ), + cloneAddressGroupItemsMetadata.decode.bind( + cloneAddressGroupItemsMetadata, + ), + ), deleteAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAddressGroupResponse.decode.bind(deleteAddressGroupResponse), - deleteAddressGroupMetadata.decode.bind(deleteAddressGroupMetadata)) + deleteAddressGroupMetadata.decode.bind(deleteAddressGroupMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.AddressGroupService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.AddressGroupService', + 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 @@ -396,28 +584,44 @@ export class AddressGroupServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.AddressGroupService. this.addressGroupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.AddressGroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1.AddressGroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.AddressGroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .AddressGroupService, + 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 addressGroupServiceStubMethods = - ['listAddressGroups', 'getAddressGroup', 'createAddressGroup', 'updateAddressGroup', 'addAddressGroupItems', 'removeAddressGroupItems', 'cloneAddressGroupItems', 'deleteAddressGroup', 'listAddressGroupReferences']; + const addressGroupServiceStubMethods = [ + 'listAddressGroups', + 'getAddressGroup', + 'createAddressGroup', + 'updateAddressGroup', + 'addAddressGroupItems', + 'removeAddressGroupItems', + 'cloneAddressGroupItems', + 'deleteAddressGroup', + 'listAddressGroupReferences', + ]; for (const methodName of addressGroupServiceStubMethods) { const callPromise = this.addressGroupServiceStub.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) => () => { + (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] || @@ -427,7 +631,7 @@ export class AddressGroupServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -442,8 +646,14 @@ export class AddressGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -454,8 +664,14 @@ export class AddressGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -486,9 +702,7 @@ export class AddressGroupServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -497,8 +711,9 @@ export class AddressGroupServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -509,941 +724,1387 @@ export class AddressGroupServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AddressGroup to get. Must be in the format - * `projects/* /locations/{location}/addressGroups/*`. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. - * 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/address_group_service.get_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_GetAddressGroup_async - */ + /** + * Gets details of a single address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AddressGroup to get. Must be in the format + * `projects/* /locations/{location}/addressGroups/*`. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. + * 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/address_group_service.get_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_GetAddressGroup_async + */ getAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ] + >; getAddressGroup( - request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAddressGroup( - request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAddressGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAddressGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAddressGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAddressGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAddressGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new address group in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the AddressGroup. Must be in the - * format `projects/* /locations/{location}`. - * @param {string} request.addressGroupId - * Required. Short name of the AddressGroup resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "authz_policy". - * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup - * Required. AddressGroup resource to be created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.create_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_CreateAddressGroup_async - */ + /** + * Creates a new address group in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the AddressGroup. Must be in the + * format `projects/* /locations/{location}`. + * @param {string} request.addressGroupId + * Required. Short name of the AddressGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "authz_policy". + * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup + * Required. AddressGroup resource to be created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.create_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_CreateAddressGroup_async + */ createAddressGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAddressGroup( - request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAddressGroup( - request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAddressGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAddressGroup request %j', request); - return this.innerApiCalls.createAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAddressGroup()`. - * @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/address_group_service.create_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_CreateAddressGroup_async - */ - async checkCreateAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAddressGroup()`. + * @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/address_group_service.create_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_CreateAddressGroup_async + */ + async checkCreateAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * AddressGroup resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup - * Required. Updated AddressGroup resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.update_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_UpdateAddressGroup_async - */ + /** + * Updates the parameters of a single address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * AddressGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup + * Required. Updated AddressGroup resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.update_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_UpdateAddressGroup_async + */ updateAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAddressGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAddressGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group.name': request.addressGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'address_group.name': request.addressGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAddressGroup request %j', request); - return this.innerApiCalls.updateAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAddressGroup()`. - * @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/address_group_service.update_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_UpdateAddressGroup_async - */ - async checkUpdateAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAddressGroup()`. + * @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/address_group_service.update_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_UpdateAddressGroup_async + */ + async checkUpdateAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Adds items to an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to add items to. Must be in the format - * `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string[]} request.items - * Required. List of items to add. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.add_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_AddAddressGroupItems_async - */ + /** + * Adds items to an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to add items to. Must be in the format + * `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string[]} request.items + * Required. List of items to add. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.add_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_AddAddressGroupItems_async + */ addAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; addAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('addAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('addAddressGroupItems request %j', request); - return this.innerApiCalls.addAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .addAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('addAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `addAddressGroupItems()`. - * @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/address_group_service.add_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_AddAddressGroupItems_async - */ - async checkAddAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `addAddressGroupItems()`. + * @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/address_group_service.add_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_AddAddressGroupItems_async + */ + async checkAddAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('addAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.addAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.addAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Removes items from an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to remove items from. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string[]} request.items - * Required. List of items to remove. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.remove_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_RemoveAddressGroupItems_async - */ + /** + * Removes items from an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to remove items from. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string[]} request.items + * Required. List of items to remove. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.remove_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_RemoveAddressGroupItems_async + */ removeAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; removeAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('removeAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('removeAddressGroupItems request %j', request); - return this.innerApiCalls.removeAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .removeAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('removeAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `removeAddressGroupItems()`. - * @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/address_group_service.remove_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_RemoveAddressGroupItems_async - */ - async checkRemoveAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `removeAddressGroupItems()`. + * @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/address_group_service.remove_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_RemoveAddressGroupItems_async + */ + async checkRemoveAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('removeAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.removeAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.removeAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Clones items from one address group to another. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string} request.sourceAddressGroup - * Required. Source address group to clone items from. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.clone_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_CloneAddressGroupItems_async - */ + /** + * Clones items from one address group to another. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string} request.sourceAddressGroup + * Required. Source address group to clone items from. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.clone_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_CloneAddressGroupItems_async + */ cloneAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cloneAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cloneAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cloneAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cloneAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cloneAddressGroupItems request %j', request); - return this.innerApiCalls.cloneAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cloneAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cloneAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cloneAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cloneAddressGroupItems()`. - * @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/address_group_service.clone_address_group_items.js - * region_tag:networksecurity_v1_generated_AddressGroupService_CloneAddressGroupItems_async - */ - async checkCloneAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cloneAddressGroupItems()`. + * @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/address_group_service.clone_address_group_items.js + * region_tag:networksecurity_v1_generated_AddressGroupService_CloneAddressGroupItems_async + */ + async checkCloneAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('cloneAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.cloneAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cloneAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AddressGroup to delete. Must be in the format - * `projects/* /locations/{location}/addressGroups/*`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/address_group_service.delete_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_DeleteAddressGroup_async - */ + /** + * Deletes a single address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AddressGroup to delete. Must be in the format + * `projects/* /locations/{location}/addressGroups/*`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/address_group_service.delete_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_DeleteAddressGroup_async + */ deleteAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAddressGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAddressGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAddressGroup request %j', request); - return this.innerApiCalls.deleteAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAddressGroup()`. - * @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/address_group_service.delete_address_group.js - * region_tag:networksecurity_v1_generated_AddressGroupService_DeleteAddressGroup_async - */ - async checkDeleteAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAddressGroup()`. + * @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/address_group_service.delete_address_group.js + * region_tag:networksecurity_v1_generated_AddressGroupService_DeleteAddressGroup_async + */ + async checkDeleteAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists address groups in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. - * 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 `listAddressGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists address groups in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. + * 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 `listAddressGroupsAsync()` + * 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. + */ listAddressGroups( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ] + >; listAddressGroups( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): void; listAddressGroups( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): void; listAddressGroups( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAddressGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1452,211 +2113,240 @@ export class AddressGroupServiceClient { this._log.info('listAddressGroups request %j', request); return this.innerApiCalls .listAddressGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]) => { - this._log.info('listAddressGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ]) => { + this._log.info('listAddressGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAddressGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup} 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 `listAddressGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listAddressGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup} 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 `listAddressGroupsAsync()` + * 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. + */ listAddressGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroups stream %j', request); return this.descriptors.page.listAddressGroups.createStream( this.innerApiCalls.listAddressGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAddressGroups`, 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 project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. 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/address_group_service.list_address_groups.js - * region_tag:networksecurity_v1_generated_AddressGroupService_ListAddressGroups_async - */ + /** + * Equivalent to `listAddressGroups`, 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 project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. 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/address_group_service.list_address_groups.js + * region_tag:networksecurity_v1_generated_AddressGroupService_ListAddressGroups_async + */ listAddressGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroups iterate %j', request); return this.descriptors.page.listAddressGroups.asyncIterate( this.innerApiCalls['listAddressGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists references of an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. - * 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 `listAddressGroupReferencesAsync()` - * 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. - */ + /** + * Lists references of an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. + * 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 `listAddressGroupReferencesAsync()` + * 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. + */ listAddressGroupReferences( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ] + >; listAddressGroupReferences( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): void; listAddressGroupReferences( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): void; listAddressGroupReferences( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): - Promise<[ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAddressGroupReferences values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1665,145 +2355,149 @@ export class AddressGroupServiceClient { this._log.info('listAddressGroupReferences request %j', request); return this.innerApiCalls .listAddressGroupReferences(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]) => { - this._log.info('listAddressGroupReferences values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ]) => { + this._log.info('listAddressGroupReferences values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAddressGroupReferences`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference} 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 `listAddressGroupReferencesAsync()` - * 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. - */ + /** + * Equivalent to `listAddressGroupReferences`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference} 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 `listAddressGroupReferencesAsync()` + * 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. + */ listAddressGroupReferencesStream( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + 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({ - 'address_group': request.addressGroup ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroupReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroupReferences stream %j', request); return this.descriptors.page.listAddressGroupReferences.createStream( this.innerApiCalls.listAddressGroupReferences as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAddressGroupReferences`, 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.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. 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/address_group_service.list_address_group_references.js - * region_tag:networksecurity_v1_generated_AddressGroupService_ListAddressGroupReferences_async - */ + /** + * Equivalent to `listAddressGroupReferences`, 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.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. 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/address_group_service.list_address_group_references.js + * region_tag:networksecurity_v1_generated_AddressGroupService_ListAddressGroupReferences_async + */ listAddressGroupReferencesAsync( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + 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({ - 'address_group': request.addressGroup ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroupReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroupReferences iterate %j', request); return this.descriptors.page.listAddressGroupReferences.asyncIterate( this.innerApiCalls['listAddressGroupReferences'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1817,40 +2511,40 @@ export class AddressGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1864,41 +2558,41 @@ export class AddressGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1912,12 +2606,12 @@ export class AddressGroupServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1952,12 +2646,11 @@ export class AddressGroupServiceClient { | 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. @@ -1990,12 +2683,12 @@ export class AddressGroupServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2038,22 +2731,22 @@ export class AddressGroupServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2088,15 +2781,15 @@ export class AddressGroupServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2130,7 +2823,7 @@ export class AddressGroupServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2143,25 +2836,24 @@ export class AddressGroupServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2200,22 +2892,22 @@ export class AddressGroupServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2231,7 +2923,11 @@ export class AddressGroupServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2247,7 +2943,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2258,7 +2956,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2268,8 +2968,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2280,7 +2984,7 @@ export class AddressGroupServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2296,7 +3000,8 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2307,7 +3012,8 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2318,7 +3024,8 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2329,7 +3036,11 @@ export class AddressGroupServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2344,8 +3055,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2355,8 +3070,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2366,8 +3085,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2378,7 +3101,11 @@ export class AddressGroupServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2394,7 +3121,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2405,7 +3134,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2416,7 +3147,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2427,7 +3160,11 @@ export class AddressGroupServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2443,7 +3180,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2454,7 +3193,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2464,8 +3205,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2476,7 +3221,11 @@ export class AddressGroupServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2491,8 +3240,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2502,8 +3255,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2513,8 +3270,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2525,7 +3286,11 @@ export class AddressGroupServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2541,7 +3306,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2551,8 +3318,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2562,8 +3333,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2575,7 +3350,12 @@ export class AddressGroupServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2591,8 +3371,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2602,8 +3386,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2613,8 +3401,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2624,8 +3416,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2636,7 +3432,11 @@ export class AddressGroupServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2652,7 +3452,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2663,7 +3465,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2673,8 +3477,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2685,7 +3493,11 @@ export class AddressGroupServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2700,8 +3512,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2711,8 +3527,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2722,8 +3542,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2734,7 +3558,11 @@ export class AddressGroupServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2749,8 +3577,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2760,8 +3592,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2771,8 +3607,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2783,12 +3623,18 @@ export class AddressGroupServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2798,8 +3644,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2809,8 +3659,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2820,8 +3674,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2831,7 +3689,7 @@ export class AddressGroupServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2868,7 +3726,11 @@ export class AddressGroupServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2884,7 +3746,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2895,7 +3759,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2905,8 +3771,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -2917,7 +3787,11 @@ export class AddressGroupServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2932,8 +3806,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -2943,8 +3821,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -2954,8 +3836,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -2966,7 +3852,11 @@ export class AddressGroupServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2981,8 +3871,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2992,8 +3886,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -3003,8 +3901,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -3015,12 +3917,18 @@ export class AddressGroupServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3030,8 +3938,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3041,8 +3953,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3052,8 +3968,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3064,12 +3984,18 @@ export class AddressGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -3079,8 +4005,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -3090,8 +4020,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -3101,8 +4035,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -3113,12 +4051,18 @@ export class AddressGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3128,8 +4072,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3139,8 +4087,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3150,8 +4102,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3162,12 +4118,18 @@ export class AddressGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3177,8 +4139,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3188,8 +4154,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3199,8 +4169,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3211,12 +4185,18 @@ export class AddressGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3226,8 +4206,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3237,8 +4221,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3248,8 +4236,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3258,7 +4250,7 @@ export class AddressGroupServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3283,7 +4275,11 @@ export class AddressGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -3298,8 +4294,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -3309,8 +4309,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -3320,8 +4324,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -3332,12 +4340,18 @@ export class AddressGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3347,8 +4361,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3358,8 +4376,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3369,8 +4391,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3381,12 +4407,18 @@ export class AddressGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3396,8 +4428,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3407,8 +4443,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3418,8 +4458,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3430,12 +4474,18 @@ export class AddressGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3445,8 +4495,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3456,8 +4510,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3467,8 +4525,114 @@ export class AddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3479,7 +4643,11 @@ export class AddressGroupServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3495,7 +4663,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3506,7 +4676,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3517,7 +4689,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3528,7 +4702,11 @@ export class AddressGroupServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3544,7 +4722,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3555,7 +4735,9 @@ export class AddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3565,8 +4747,12 @@ export class AddressGroupServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3577,7 +4763,7 @@ export class AddressGroupServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3626,15 +4812,19 @@ export class AddressGroupServiceClient { */ close(): Promise { if (this.addressGroupServiceStub && !this._terminated) { - return this.addressGroupServiceStub.then(stub => { + return this.addressGroupServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/address_group_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/address_group_service_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/address_group_service_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/address_group_service_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_client.ts b/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_client.ts index b95e05099e6c..5a52d27c6f9b 100644 --- a/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +55,7 @@ export class DnsThreatDetectorServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,11 +68,11 @@ export class DnsThreatDetectorServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - dnsThreatDetectorServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + dnsThreatDetectorServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of DnsThreatDetectorServiceClient. @@ -102,21 +113,43 @@ export class DnsThreatDetectorServiceClient { * const client = new DnsThreatDetectorServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DnsThreatDetectorServiceClient; - 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 staticMembers = this + .constructor as typeof DnsThreatDetectorServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -141,7 +174,7 @@ export class DnsThreatDetectorServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,18 +187,14 @@ export class DnsThreatDetectorServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -187,94 +216,109 @@ export class DnsThreatDetectorServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -282,14 +326,20 @@ export class DnsThreatDetectorServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listDnsThreatDetectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dnsThreatDetectors') + listDnsThreatDetectors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dnsThreatDetectors', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.DnsThreatDetectorService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.DnsThreatDetectorService', + 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 @@ -320,37 +370,47 @@ export class DnsThreatDetectorServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.DnsThreatDetectorService. this.dnsThreatDetectorServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.DnsThreatDetectorService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1.DnsThreatDetectorService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.DnsThreatDetectorService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .DnsThreatDetectorService, + 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 dnsThreatDetectorServiceStubMethods = - ['listDnsThreatDetectors', 'getDnsThreatDetector', 'createDnsThreatDetector', 'updateDnsThreatDetector', 'deleteDnsThreatDetector']; + const dnsThreatDetectorServiceStubMethods = [ + 'listDnsThreatDetectors', + 'getDnsThreatDetector', + 'createDnsThreatDetector', + 'updateDnsThreatDetector', + 'deleteDnsThreatDetector', + ]; for (const methodName of dnsThreatDetectorServiceStubMethods) { const callPromise = this.dnsThreatDetectorServiceStub.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) => () => { + (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] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -365,8 +425,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -377,8 +443,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -409,9 +481,7 @@ export class DnsThreatDetectorServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -420,8 +490,9 @@ export class DnsThreatDetectorServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -432,478 +503,699 @@ export class DnsThreatDetectorServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets the details of a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. - * 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/dns_threat_detector_service.get_dns_threat_detector.js - * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async - */ + /** + * Gets the details of a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. + * 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/dns_threat_detector_service.get_dns_threat_detector.js + * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async + */ getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new DnsThreatDetector in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The value for the parent of the DnsThreatDetector resource. - * @param {string} [request.dnsThreatDetectorId] - * Optional. The ID of the requesting DnsThreatDetector object. - * If this field is not supplied, the service generates an identifier. - * @param {google.cloud.networksecurity.v1.DnsThreatDetector} request.dnsThreatDetector - * Required. The `DnsThreatDetector` resource to create. - * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. - * 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/dns_threat_detector_service.create_dns_threat_detector.js - * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async - */ + /** + * Creates a new DnsThreatDetector in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The value for the parent of the DnsThreatDetector resource. + * @param {string} [request.dnsThreatDetectorId] + * Optional. The ID of the requesting DnsThreatDetector object. + * If this field is not supplied, the service generates an identifier. + * @param {google.cloud.networksecurity.v1.DnsThreatDetector} request.dnsThreatDetector + * Required. The `DnsThreatDetector` resource to create. + * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. + * 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/dns_threat_detector_service.create_dns_threat_detector.js + * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async + */ createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The field mask is used to specify the fields to be overwritten in - * the DnsThreatDetector resource by the update. The fields specified in the - * update_mask are relative to the resource, not the full request. A field - * will be overwritten if it is in the mask. If the mask is not provided then - * all fields present in the request will be overwritten. - * @param {google.cloud.networksecurity.v1.DnsThreatDetector} request.dnsThreatDetector - * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. - * 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/dns_threat_detector_service.update_dns_threat_detector.js - * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async - */ + /** + * Updates a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The field mask is used to specify the fields to be overwritten in + * the DnsThreatDetector resource by the update. The fields specified in the + * update_mask are relative to the resource, not the full request. A field + * will be overwritten if it is in the mask. If the mask is not provided then + * all fields present in the request will be overwritten. + * @param {google.cloud.networksecurity.v1.DnsThreatDetector} request.dnsThreatDetector + * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. + * 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/dns_threat_detector_service.update_dns_threat_detector.js + * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async + */ updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. - * 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/dns_threat_detector_service.delete_dns_threat_detector.js - * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async - */ + /** + * Deletes a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. + * 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/dns_threat_detector_service.delete_dns_threat_detector.js + * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async + */ deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists DnsThreatDetectors in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. - * 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Lists DnsThreatDetectors in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. + * 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse, + ] + >; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IDnsThreatDetector>, - callback?: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IDnsThreatDetector>): - Promise<[ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IDnsThreatDetector + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IDnsThreatDetector + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IDnsThreatDetector>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IDnsThreatDetector + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDnsThreatDetectors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -912,139 +1204,143 @@ export class DnsThreatDetectorServiceClient { this._log.info('listDnsThreatDetectors request %j', request); return this.innerApiCalls .listDnsThreatDetectors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse - ]) => { - this._log.info('listDnsThreatDetectors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsResponse, + ]) => { + this._log.info('listDnsThreatDetectors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectorsStream( - request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors stream %j', request); return this.descriptors.page.listDnsThreatDetectors.createStream( this.innerApiCalls.listDnsThreatDetectors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. 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/dns_threat_detector_service.list_dns_threat_detectors.js - * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async - */ + /** + * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1.DnsThreatDetector|DnsThreatDetector}. 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/dns_threat_detector_service.list_dns_threat_detectors.js + * region_tag:networksecurity_v1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async + */ listDnsThreatDetectorsAsync( - request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors iterate %j', request); return this.descriptors.page.listDnsThreatDetectors.asyncIterate( this.innerApiCalls['listDnsThreatDetectors'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1058,40 +1354,40 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1105,41 +1401,41 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1153,12 +1449,12 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1193,12 +1489,11 @@ export class DnsThreatDetectorServiceClient { | 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. @@ -1231,7 +1526,7 @@ export class DnsThreatDetectorServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1248,7 +1543,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -1264,7 +1563,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -1275,7 +1576,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -1285,8 +1588,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -1297,7 +1604,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -1313,7 +1620,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -1324,7 +1632,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -1335,7 +1644,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -1346,7 +1656,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -1361,8 +1675,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -1372,8 +1690,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -1383,8 +1705,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -1395,7 +1721,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -1411,7 +1741,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -1422,7 +1754,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -1433,7 +1767,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -1444,7 +1780,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -1460,7 +1800,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -1471,7 +1813,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -1481,8 +1825,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -1493,7 +1841,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -1508,8 +1860,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -1519,8 +1875,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -1530,8 +1890,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -1542,7 +1906,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -1558,7 +1926,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -1568,8 +1938,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -1579,8 +1953,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -1592,7 +1970,12 @@ export class DnsThreatDetectorServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -1608,8 +1991,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -1619,8 +2006,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -1630,8 +2021,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -1641,8 +2036,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -1653,7 +2052,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -1669,7 +2072,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -1680,7 +2085,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -1690,8 +2097,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -1702,7 +2113,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -1717,8 +2132,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -1728,8 +2147,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -1739,8 +2162,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -1751,7 +2178,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -1766,8 +2197,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -1777,8 +2212,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -1788,8 +2227,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -1800,12 +2243,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -1815,8 +2264,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -1826,8 +2279,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -1837,8 +2294,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -1848,7 +2309,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1885,7 +2346,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -1901,7 +2366,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -1912,7 +2379,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -1922,8 +2391,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -1934,7 +2407,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -1949,8 +2426,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -1960,8 +2441,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -1971,8 +2456,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -1983,7 +2472,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -1998,8 +2491,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2009,8 +2506,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -2020,8 +2521,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -2032,12 +2537,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -2047,8 +2558,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -2058,8 +2573,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -2069,8 +2588,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -2080,7 +2603,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -2117,12 +2640,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -2132,8 +2661,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -2143,8 +2676,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -2154,8 +2691,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -2166,12 +2707,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -2181,8 +2728,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -2192,8 +2743,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -2203,8 +2758,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -2215,12 +2774,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -2230,8 +2795,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -2241,8 +2810,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -2252,8 +2825,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -2264,12 +2841,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -2279,8 +2862,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -2290,8 +2877,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -2301,8 +2892,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -2311,7 +2906,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2336,7 +2931,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -2351,8 +2950,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -2362,8 +2965,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -2373,8 +2980,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -2385,12 +2996,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -2400,8 +3017,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -2411,8 +3032,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -2422,8 +3047,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -2434,12 +3063,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -2449,8 +3084,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -2460,8 +3099,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -2471,8 +3114,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -2483,12 +3130,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -2498,8 +3151,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -2509,8 +3166,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -2520,8 +3181,114 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -2532,7 +3299,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2548,7 +3319,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -2559,7 +3332,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -2570,7 +3345,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -2581,7 +3358,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -2597,7 +3378,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -2608,7 +3391,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -2618,8 +3403,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -2630,7 +3419,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -2679,14 +3468,18 @@ export class DnsThreatDetectorServiceClient { */ close(): Promise { if (this.dnsThreatDetectorServiceStub && !this._terminated) { - return this.dnsThreatDetectorServiceStub.then(stub => { + return this.dnsThreatDetectorServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/dns_threat_detector_service_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/firewall_activation_client.ts b/packages/google-cloud-networksecurity/src/v1/firewall_activation_client.ts index 34c8628adbfa..2cb17ae97d51 100644 --- a/packages/google-cloud-networksecurity/src/v1/firewall_activation_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/firewall_activation_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class FirewallActivationClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class FirewallActivationClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - firewallActivationStub?: Promise<{[name: string]: Function}>; + firewallActivationStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of FirewallActivationClient. @@ -103,21 +116,42 @@ export class FirewallActivationClient { * const client = new FirewallActivationClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof FirewallActivationClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class FirewallActivationClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class FirewallActivationClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,97 +218,112 @@ export class FirewallActivationClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' + 'organizations/{organization}', ), organizationLocationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'organizations/{organization}/locations/{location}', ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -286,10 +331,21 @@ export class FirewallActivationClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listFirewallEndpoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'firewallEndpoints'), - listFirewallEndpointAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'firewallEndpointAssociations') + listFirewallEndpoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'firewallEndpoints', + ), + listProjectFirewallEndpoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'firewallEndpoints', + ), + listFirewallEndpointAssociations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'firewallEndpointAssociations', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -298,78 +354,279 @@ export class FirewallActivationClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.FirewallEndpoint') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.FirewallEndpoint', + ) as gax.protobuf.Type; const createFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const createProjectFirewallEndpointResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.FirewallEndpoint', + ) as gax.protobuf.Type; + const createProjectFirewallEndpointMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteProjectFirewallEndpointResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteProjectFirewallEndpointMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.FirewallEndpoint') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.FirewallEndpoint', + ) as gax.protobuf.Type; const updateFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateProjectFirewallEndpointResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.FirewallEndpoint', + ) as gax.protobuf.Type; + const updateProjectFirewallEndpointMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.FirewallEndpointAssociation') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.FirewallEndpointAssociation', + ) as gax.protobuf.Type; const createFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.FirewallEndpointAssociation') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.FirewallEndpointAssociation', + ) as gax.protobuf.Type; const updateFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createFirewallEndpointResponse.decode.bind(createFirewallEndpointResponse), - createFirewallEndpointMetadata.decode.bind(createFirewallEndpointMetadata)), - deleteFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( + createFirewallEndpointResponse.decode.bind( + createFirewallEndpointResponse, + ), + createFirewallEndpointMetadata.decode.bind( + createFirewallEndpointMetadata, + ), + ), + createProjectFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteFirewallEndpointResponse.decode.bind(deleteFirewallEndpointResponse), - deleteFirewallEndpointMetadata.decode.bind(deleteFirewallEndpointMetadata)), - updateFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( + createProjectFirewallEndpointResponse.decode.bind( + createProjectFirewallEndpointResponse, + ), + createProjectFirewallEndpointMetadata.decode.bind( + createProjectFirewallEndpointMetadata, + ), + ), + deleteFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateFirewallEndpointResponse.decode.bind(updateFirewallEndpointResponse), - updateFirewallEndpointMetadata.decode.bind(updateFirewallEndpointMetadata)), - createFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( + deleteFirewallEndpointResponse.decode.bind( + deleteFirewallEndpointResponse, + ), + deleteFirewallEndpointMetadata.decode.bind( + deleteFirewallEndpointMetadata, + ), + ), + deleteProjectFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createFirewallEndpointAssociationResponse.decode.bind(createFirewallEndpointAssociationResponse), - createFirewallEndpointAssociationMetadata.decode.bind(createFirewallEndpointAssociationMetadata)), - deleteFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( + deleteProjectFirewallEndpointResponse.decode.bind( + deleteProjectFirewallEndpointResponse, + ), + deleteProjectFirewallEndpointMetadata.decode.bind( + deleteProjectFirewallEndpointMetadata, + ), + ), + updateFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteFirewallEndpointAssociationResponse.decode.bind(deleteFirewallEndpointAssociationResponse), - deleteFirewallEndpointAssociationMetadata.decode.bind(deleteFirewallEndpointAssociationMetadata)), - updateFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( + updateFirewallEndpointResponse.decode.bind( + updateFirewallEndpointResponse, + ), + updateFirewallEndpointMetadata.decode.bind( + updateFirewallEndpointMetadata, + ), + ), + updateProjectFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateFirewallEndpointAssociationResponse.decode.bind(updateFirewallEndpointAssociationResponse), - updateFirewallEndpointAssociationMetadata.decode.bind(updateFirewallEndpointAssociationMetadata)) + updateProjectFirewallEndpointResponse.decode.bind( + updateProjectFirewallEndpointResponse, + ), + updateProjectFirewallEndpointMetadata.decode.bind( + updateProjectFirewallEndpointMetadata, + ), + ), + createFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFirewallEndpointAssociationResponse.decode.bind( + createFirewallEndpointAssociationResponse, + ), + createFirewallEndpointAssociationMetadata.decode.bind( + createFirewallEndpointAssociationMetadata, + ), + ), + deleteFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFirewallEndpointAssociationResponse.decode.bind( + deleteFirewallEndpointAssociationResponse, + ), + deleteFirewallEndpointAssociationMetadata.decode.bind( + deleteFirewallEndpointAssociationMetadata, + ), + ), + updateFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFirewallEndpointAssociationResponse.decode.bind( + updateFirewallEndpointAssociationResponse, + ), + updateFirewallEndpointAssociationMetadata.decode.bind( + updateFirewallEndpointAssociationMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.FirewallActivation', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.FirewallActivation', + 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 @@ -400,28 +657,50 @@ export class FirewallActivationClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.FirewallActivation. this.firewallActivationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.FirewallActivation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1.FirewallActivation, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.FirewallActivation', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .FirewallActivation, + 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 firewallActivationStubMethods = - ['listFirewallEndpoints', 'getFirewallEndpoint', 'createFirewallEndpoint', 'deleteFirewallEndpoint', 'updateFirewallEndpoint', 'listFirewallEndpointAssociations', 'getFirewallEndpointAssociation', 'createFirewallEndpointAssociation', 'deleteFirewallEndpointAssociation', 'updateFirewallEndpointAssociation']; + const firewallActivationStubMethods = [ + 'listFirewallEndpoints', + 'listProjectFirewallEndpoints', + 'getFirewallEndpoint', + 'getProjectFirewallEndpoint', + 'createFirewallEndpoint', + 'createProjectFirewallEndpoint', + 'deleteFirewallEndpoint', + 'deleteProjectFirewallEndpoint', + 'updateFirewallEndpoint', + 'updateProjectFirewallEndpoint', + 'listFirewallEndpointAssociations', + 'getFirewallEndpointAssociation', + 'createFirewallEndpointAssociation', + 'deleteFirewallEndpointAssociation', + 'updateFirewallEndpointAssociation', + ]; for (const methodName of firewallActivationStubMethods) { const callPromise = this.firewallActivationStub.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) => () => { + (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] || @@ -431,7 +710,7 @@ export class FirewallActivationClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -446,8 +725,14 @@ export class FirewallActivationClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -458,8 +743,14 @@ export class FirewallActivationClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -490,9 +781,7 @@ export class FirewallActivationClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -501,8 +790,9 @@ export class FirewallActivationClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -513,1031 +803,2273 @@ export class FirewallActivationClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single org Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. - * 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/firewall_activation.get_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_GetFirewallEndpoint_async - */ + /** + * Gets details of a single org Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. + * 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/firewall_activation.get_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_GetFirewallEndpoint_async + */ getFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ] + >; getFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFirewallEndpoint request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getFirewallEndpoint response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFirewallEndpoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getFirewallEndpoint response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. - * 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/firewall_activation.get_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_GetFirewallEndpointAssociation_async - */ + /** + * Gets details of a single project Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. + * 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/firewall_activation.get_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_GetProjectFirewallEndpoint_async + */ + getProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ] + >; + getProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | 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().catch((err) => { + throw err; + }); + this._log.info('getProjectFirewallEndpoint request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getProjectFirewallEndpoint response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getProjectFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getProjectFirewallEndpoint response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets details of a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. + * 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/firewall_activation.get_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_GetFirewallEndpointAssociation_async + */ getFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFirewallEndpointAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getFirewallEndpointAssociation response %j', response); + this._log.info( + 'getFirewallEndpointAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFirewallEndpointAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getFirewallEndpointAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new FirewallEndpoint in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.firewallEndpointId - * Required. Id of the requesting object. - * If auto-generating Id server-side, remove this field and - * firewall_endpoint_id from the method_signature of Create RPC. - * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.create_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpoint_async - */ + /** + * Creates a new FirewallEndpoint in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.firewallEndpointId + * Required. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_id from the method_signature of Create RPC. + * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.create_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpoint_async + */ createFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createFirewallEndpoint request %j', request); - return this.innerApiCalls.createFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createFirewallEndpoint()`. - * @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/firewall_activation.create_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpoint_async - */ - async checkCreateFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createFirewallEndpoint()`. + * @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/firewall_activation.create_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpoint_async + */ + async checkCreateFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single org Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.delete_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpoint_async - */ - deleteFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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 || {}; + /** + * Creates a new FirewallEndpoint in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.firewallEndpointId + * Required. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_id from the method_signature of Create RPC. + * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.create_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_async + */ + createProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info( + 'createProjectFirewallEndpoint response %j', + rawResponse, + ); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createProjectFirewallEndpoint request %j', request); + return this.innerApiCalls + .createProjectFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createProjectFirewallEndpoint response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createProjectFirewallEndpoint()`. + * @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/firewall_activation.create_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_async + */ + async checkCreateProjectFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('createProjectFirewallEndpoint long-running'); + 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.createProjectFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Deletes a single org Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.delete_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpoint_async + */ + deleteFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteFirewallEndpoint request %j', request); - return this.innerApiCalls.deleteFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteFirewallEndpoint()`. - * @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/firewall_activation.delete_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpoint_async - */ - async checkDeleteFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteFirewallEndpoint()`. + * @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/firewall_activation.delete_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpoint_async + */ + async checkDeleteFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Update a single org Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Endpoint resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.update_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpoint_async - */ + /** + * Deletes a single project Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.delete_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_async + */ + deleteProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info( + 'deleteProjectFirewallEndpoint response %j', + rawResponse, + ); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteProjectFirewallEndpoint request %j', request); + return this.innerApiCalls + .deleteProjectFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteProjectFirewallEndpoint response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteProjectFirewallEndpoint()`. + * @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/firewall_activation.delete_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_async + */ + async checkDeleteProjectFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('deleteProjectFirewallEndpoint long-running'); + 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.deleteProjectFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Update a single org Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Endpoint resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.update_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpoint_async + */ updateFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'firewall_endpoint.name': request.firewallEndpoint!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'firewall_endpoint.name': request.firewallEndpoint!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateFirewallEndpoint request %j', request); - return this.innerApiCalls.updateFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateFirewallEndpoint()`. - * @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/firewall_activation.update_firewall_endpoint.js - * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpoint_async - */ - async checkUpdateFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateFirewallEndpoint()`. + * @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/firewall_activation.update_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpoint_async + */ + async checkUpdateFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new FirewallEndpointAssociation in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} [request.firewallEndpointAssociationId] - * Optional. Id of the requesting object. - * If auto-generating Id server-side, remove this field and - * firewall_endpoint_association_id from the method_signature of Create RPC. - * @param {google.cloud.networksecurity.v1.FirewallEndpointAssociation} request.firewallEndpointAssociation - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.create_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async - */ + /** + * Update a single project Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Endpoint resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.update_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateProjectFirewallEndpoint_async + */ + updateProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateProjectFirewallEndpoint( + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateProjectFirewallEndpoint( + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.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({ + 'firewall_endpoint.name': request.firewallEndpoint!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info( + 'updateProjectFirewallEndpoint response %j', + rawResponse, + ); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateProjectFirewallEndpoint request %j', request); + return this.innerApiCalls + .updateProjectFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateProjectFirewallEndpoint response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateProjectFirewallEndpoint()`. + * @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/firewall_activation.update_project_firewall_endpoint.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateProjectFirewallEndpoint_async + */ + async checkUpdateProjectFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('updateProjectFirewallEndpoint long-running'); + 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.updateProjectFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Creates a new FirewallEndpointAssociation in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} [request.firewallEndpointAssociationId] + * Optional. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_association_id from the method_signature of Create RPC. + * @param {google.cloud.networksecurity.v1.FirewallEndpointAssociation} request.firewallEndpointAssociation + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.create_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async + */ createFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'createFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.createFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createFirewallEndpointAssociation()`. - * @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/firewall_activation.create_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async - */ - async checkCreateFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createFirewallEndpointAssociation()`. + * @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/firewall_activation.create_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async + */ + async checkCreateFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.delete_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async - */ + /** + * Deletes a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.delete_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async + */ deleteFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'deleteFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.deleteFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteFirewallEndpointAssociation()`. - * @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/firewall_activation.delete_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async - */ - async checkDeleteFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteFirewallEndpointAssociation()`. + * @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/firewall_activation.delete_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async + */ + async checkDeleteFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Update a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Association resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.FirewallEndpointAssociation} request.firewallEndpointAssociation - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/firewall_activation.update_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async - */ + /** + * Update a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Association resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.FirewallEndpointAssociation} request.firewallEndpointAssociation + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/firewall_activation.update_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async + */ updateFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'firewall_endpoint_association.name': request.firewallEndpointAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'firewall_endpoint_association.name': + request.firewallEndpointAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'updateFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.updateFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateFirewallEndpointAssociation()`. - * @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/firewall_activation.update_firewall_endpoint_association.js - * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async - */ - async checkUpdateFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateFirewallEndpointAssociation()`. + * @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/firewall_activation.update_firewall_endpoint_association.js + * region_tag:networksecurity_v1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async + */ + async checkUpdateFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists FirewallEndpoints in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. - * 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 `listFirewallEndpointsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists FirewallEndpoints in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. + * 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 `listFirewallEndpointsAsync()` + * 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. + */ listFirewallEndpoints( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ] + >; listFirewallEndpoints( - request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpoint>): void; + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): void; listFirewallEndpoints( - request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpoint>): void; + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): void; listFirewallEndpoints( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpoint>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpoint>): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFirewallEndpoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1546,204 +3078,468 @@ export class FirewallActivationClient { this._log.info('listFirewallEndpoints request %j', request); return this.innerApiCalls .listFirewallEndpoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse - ]) => { - this._log.info('listFirewallEndpoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ]) => { + this._log.info('listFirewallEndpoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFirewallEndpoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint} 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 `listFirewallEndpointsAsync()` - * 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. - */ + /** + * Equivalent to `listFirewallEndpoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint} 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 `listFirewallEndpointsAsync()` + * 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. + */ listFirewallEndpointsStream( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFirewallEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpoints stream %j', request); return this.descriptors.page.listFirewallEndpoints.createStream( this.innerApiCalls.listFirewallEndpoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFirewallEndpoints`, 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. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. 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/firewall_activation.list_firewall_endpoints.js - * region_tag:networksecurity_v1_generated_FirewallActivation_ListFirewallEndpoints_async - */ + /** + * Equivalent to `listFirewallEndpoints`, 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. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. 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/firewall_activation.list_firewall_endpoints.js + * region_tag:networksecurity_v1_generated_FirewallActivation_ListFirewallEndpoints_async + */ listFirewallEndpointsAsync( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + 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['listFirewallEndpoints']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listFirewallEndpoints iterate %j', request); + return this.descriptors.page.listFirewallEndpoints.asyncIterate( + this.innerApiCalls['listFirewallEndpoints'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists FirewallEndpoints in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. + * 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 `listProjectFirewallEndpointsAsync()` + * 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. + */ + listProjectFirewallEndpoints( + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ] + >; + listProjectFirewallEndpoints( + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): void; + listProjectFirewallEndpoints( + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): void; + listProjectFirewallEndpoints( + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ] + > | 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().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpoint + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listProjectFirewallEndpoints values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listProjectFirewallEndpoints request %j', request); + return this.innerApiCalls + .listProjectFirewallEndpoints(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointsResponse, + ]) => { + this._log.info('listProjectFirewallEndpoints values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listProjectFirewallEndpoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint} 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 `listProjectFirewallEndpointsAsync()` + * 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. + */ + listProjectFirewallEndpointsStream( + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + 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['listProjectFirewallEndpoints']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listProjectFirewallEndpoints stream %j', request); + return this.descriptors.page.listProjectFirewallEndpoints.createStream( + this.innerApiCalls.listProjectFirewallEndpoints as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listProjectFirewallEndpoints`, 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. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpoint|FirewallEndpoint}. 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/firewall_activation.list_project_firewall_endpoints.js + * region_tag:networksecurity_v1_generated_FirewallActivation_ListProjectFirewallEndpoints_async + */ + listProjectFirewallEndpointsAsync( + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointsRequest, + 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['listFirewallEndpoints']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listProjectFirewallEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listFirewallEndpoints iterate %j', request); - return this.descriptors.page.listFirewallEndpoints.asyncIterate( - this.innerApiCalls['listFirewallEndpoints'] as GaxCall, + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listProjectFirewallEndpoints iterate %j', request); + return this.descriptors.page.listProjectFirewallEndpoints.asyncIterate( + this.innerApiCalls['listProjectFirewallEndpoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Associations in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. - * 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 `listFirewallEndpointAssociationsAsync()` - * 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. - */ + /** + * Lists Associations in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. + * 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 `listFirewallEndpointAssociationsAsync()` + * 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. + */ listFirewallEndpointAssociations( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse, + ] + >; listFirewallEndpointAssociations( - request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation + >, + ): void; listFirewallEndpointAssociations( - request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation + >, + ): void; listFirewallEndpointAssociations( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFirewallEndpointAssociations values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1752,143 +3548,152 @@ export class FirewallActivationClient { this._log.info('listFirewallEndpointAssociations request %j', request); return this.innerApiCalls .listFirewallEndpointAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse - ]) => { - this._log.info('listFirewallEndpointAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsResponse, + ]) => { + this._log.info( + 'listFirewallEndpointAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFirewallEndpointAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation} 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 `listFirewallEndpointAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listFirewallEndpointAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation} 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 `listFirewallEndpointAssociationsAsync()` + * 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. + */ listFirewallEndpointAssociationsStream( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + 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['listFirewallEndpointAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listFirewallEndpointAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpointAssociations stream %j', request); return this.descriptors.page.listFirewallEndpointAssociations.createStream( this.innerApiCalls.listFirewallEndpointAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFirewallEndpointAssociations`, 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. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. 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/firewall_activation.list_firewall_endpoint_associations.js - * region_tag:networksecurity_v1_generated_FirewallActivation_ListFirewallEndpointAssociations_async - */ + /** + * Equivalent to `listFirewallEndpointAssociations`, 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. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1.FirewallEndpointAssociation|FirewallEndpointAssociation}. 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/firewall_activation.list_firewall_endpoint_associations.js + * region_tag:networksecurity_v1_generated_FirewallActivation_ListFirewallEndpointAssociations_async + */ listFirewallEndpointAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListFirewallEndpointAssociationsRequest, + 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['listFirewallEndpointAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listFirewallEndpointAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpointAssociations iterate %j', request); return this.descriptors.page.listFirewallEndpointAssociations.asyncIterate( this.innerApiCalls['listFirewallEndpointAssociations'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1902,40 +3707,40 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1949,41 +3754,41 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1997,12 +3802,12 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -2037,12 +3842,11 @@ export class FirewallActivationClient { | 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. @@ -2075,12 +3879,12 @@ export class FirewallActivationClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2123,22 +3927,22 @@ export class FirewallActivationClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2173,15 +3977,15 @@ export class FirewallActivationClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2215,7 +4019,7 @@ export class FirewallActivationClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2228,25 +4032,24 @@ export class FirewallActivationClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2285,22 +4088,22 @@ export class FirewallActivationClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2316,7 +4119,11 @@ export class FirewallActivationClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2332,7 +4139,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2343,7 +4152,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2353,8 +4164,12 @@ export class FirewallActivationClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2365,7 +4180,7 @@ export class FirewallActivationClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2381,7 +4196,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2392,7 +4208,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2403,7 +4220,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2414,7 +4232,11 @@ export class FirewallActivationClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2429,8 +4251,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2440,8 +4266,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2451,8 +4281,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2463,7 +4297,11 @@ export class FirewallActivationClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2479,7 +4317,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2490,7 +4330,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2501,7 +4343,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2512,7 +4356,11 @@ export class FirewallActivationClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2528,7 +4376,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2539,7 +4389,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2549,8 +4401,12 @@ export class FirewallActivationClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2561,7 +4417,11 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2576,8 +4436,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2587,8 +4451,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2598,8 +4466,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2610,7 +4482,11 @@ export class FirewallActivationClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2626,7 +4502,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2636,8 +4514,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2647,8 +4529,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2660,7 +4546,12 @@ export class FirewallActivationClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2676,8 +4567,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2687,8 +4582,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2698,8 +4597,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2709,8 +4612,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2721,7 +4628,11 @@ export class FirewallActivationClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2737,7 +4648,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2748,7 +4661,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2758,8 +4673,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2770,7 +4689,11 @@ export class FirewallActivationClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2785,8 +4708,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2796,8 +4723,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2807,8 +4738,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2819,7 +4754,11 @@ export class FirewallActivationClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2834,8 +4773,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2845,8 +4788,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2856,8 +4803,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2868,12 +4819,18 @@ export class FirewallActivationClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2883,8 +4840,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2894,8 +4855,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2905,8 +4870,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2916,7 +4885,7 @@ export class FirewallActivationClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2953,7 +4922,11 @@ export class FirewallActivationClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2969,7 +4942,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2980,7 +4955,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2990,8 +4967,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -3002,7 +4983,11 @@ export class FirewallActivationClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -3017,8 +5002,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -3028,8 +5017,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -3039,8 +5032,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -3051,7 +5048,11 @@ export class FirewallActivationClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -3066,8 +5067,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -3077,8 +5082,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -3088,8 +5097,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -3100,12 +5113,18 @@ export class FirewallActivationClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3115,8 +5134,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3126,8 +5149,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3137,8 +5164,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3147,7 +5178,7 @@ export class FirewallActivationClient { * @param {string} organization * @returns {string} Resource name string. */ - organizationPath(organization:string) { + organizationPath(organization: string) { return this.pathTemplates.organizationPathTemplate.render({ organization: organization, }); @@ -3161,7 +5192,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; } /** @@ -3171,7 +5203,7 @@ export class FirewallActivationClient { * @param {string} location * @returns {string} Resource name string. */ - organizationLocationPath(organization:string,location:string) { + organizationLocationPath(organization: string, location: string) { return this.pathTemplates.organizationLocationPathTemplate.render({ organization: organization, location: location, @@ -3185,8 +5217,12 @@ export class FirewallActivationClient { * A fully-qualified path representing OrganizationLocation resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).organization; + matchOrganizationFromOrganizationLocationName( + organizationLocationName: string, + ) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).organization; } /** @@ -3197,7 +5233,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).location; + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).location; } /** @@ -3208,12 +5246,18 @@ export class FirewallActivationClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -3223,8 +5267,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -3234,8 +5282,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -3245,8 +5297,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -3257,12 +5313,18 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3272,8 +5334,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3283,8 +5349,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3294,8 +5364,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3306,12 +5380,18 @@ export class FirewallActivationClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3321,8 +5401,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3332,8 +5416,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3343,8 +5431,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3355,12 +5447,18 @@ export class FirewallActivationClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3370,8 +5468,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3381,8 +5483,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3392,8 +5498,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3402,7 +5512,7 @@ export class FirewallActivationClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3427,7 +5537,11 @@ export class FirewallActivationClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -3442,8 +5556,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -3453,8 +5571,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -3464,8 +5586,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -3476,12 +5602,18 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3491,8 +5623,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3502,8 +5638,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3513,8 +5653,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3525,12 +5669,18 @@ export class FirewallActivationClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3540,8 +5690,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3551,8 +5705,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3562,8 +5720,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3574,12 +5736,18 @@ export class FirewallActivationClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3589,8 +5757,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3600,8 +5772,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3611,8 +5787,114 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3623,7 +5905,11 @@ export class FirewallActivationClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3639,7 +5925,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3650,7 +5938,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3661,7 +5951,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3672,7 +5964,11 @@ export class FirewallActivationClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3688,7 +5984,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3699,7 +5997,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3709,8 +6009,12 @@ export class FirewallActivationClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3721,7 +6025,7 @@ export class FirewallActivationClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3770,15 +6074,19 @@ export class FirewallActivationClient { */ close(): Promise { if (this.firewallActivationStub && !this._terminated) { - return this.firewallActivationStub.then(stub => { + return this.firewallActivationStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/firewall_activation_client_config.json b/packages/google-cloud-networksecurity/src/v1/firewall_activation_client_config.json index 703c43997308..576050bb0ee3 100644 --- a/packages/google-cloud-networksecurity/src/v1/firewall_activation_client_config.json +++ b/packages/google-cloud-networksecurity/src/v1/firewall_activation_client_config.json @@ -24,22 +24,42 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ListProjectFirewallEndpoints": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GetFirewallEndpoint": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "GetProjectFirewallEndpoint": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateFirewallEndpoint": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "CreateProjectFirewallEndpoint": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeleteFirewallEndpoint": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "DeleteProjectFirewallEndpoint": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "UpdateFirewallEndpoint": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UpdateProjectFirewallEndpoint": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ListFirewallEndpointAssociations": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/packages/google-cloud-networksecurity/src/v1/firewall_activation_proto_list.json b/packages/google-cloud-networksecurity/src/v1/firewall_activation_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/firewall_activation_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/firewall_activation_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/gapic_metadata.json b/packages/google-cloud-networksecurity/src/v1/gapic_metadata.json index cd69548bf871..c1dec53169e6 100644 --- a/packages/google-cloud-networksecurity/src/v1/gapic_metadata.json +++ b/packages/google-cloud-networksecurity/src/v1/gapic_metadata.json @@ -195,6 +195,11 @@ "getFirewallEndpoint" ] }, + "GetProjectFirewallEndpoint": { + "methods": [ + "getProjectFirewallEndpoint" + ] + }, "GetFirewallEndpointAssociation": { "methods": [ "getFirewallEndpointAssociation" @@ -205,16 +210,31 @@ "createFirewallEndpoint" ] }, + "CreateProjectFirewallEndpoint": { + "methods": [ + "createProjectFirewallEndpoint" + ] + }, "DeleteFirewallEndpoint": { "methods": [ "deleteFirewallEndpoint" ] }, + "DeleteProjectFirewallEndpoint": { + "methods": [ + "deleteProjectFirewallEndpoint" + ] + }, "UpdateFirewallEndpoint": { "methods": [ "updateFirewallEndpoint" ] }, + "UpdateProjectFirewallEndpoint": { + "methods": [ + "updateProjectFirewallEndpoint" + ] + }, "CreateFirewallEndpointAssociation": { "methods": [ "createFirewallEndpointAssociation" @@ -237,6 +257,13 @@ "listFirewallEndpointsAsync" ] }, + "ListProjectFirewallEndpoints": { + "methods": [ + "listProjectFirewallEndpoints", + "listProjectFirewallEndpointsStream", + "listProjectFirewallEndpointsAsync" + ] + }, "ListFirewallEndpointAssociations": { "methods": [ "listFirewallEndpointAssociations", @@ -254,6 +281,11 @@ "getFirewallEndpoint" ] }, + "GetProjectFirewallEndpoint": { + "methods": [ + "getProjectFirewallEndpoint" + ] + }, "GetFirewallEndpointAssociation": { "methods": [ "getFirewallEndpointAssociation" @@ -264,16 +296,31 @@ "createFirewallEndpoint" ] }, + "CreateProjectFirewallEndpoint": { + "methods": [ + "createProjectFirewallEndpoint" + ] + }, "DeleteFirewallEndpoint": { "methods": [ "deleteFirewallEndpoint" ] }, + "DeleteProjectFirewallEndpoint": { + "methods": [ + "deleteProjectFirewallEndpoint" + ] + }, "UpdateFirewallEndpoint": { "methods": [ "updateFirewallEndpoint" ] }, + "UpdateProjectFirewallEndpoint": { + "methods": [ + "updateProjectFirewallEndpoint" + ] + }, "CreateFirewallEndpointAssociation": { "methods": [ "createFirewallEndpointAssociation" @@ -296,6 +343,13 @@ "listFirewallEndpointsAsync" ] }, + "ListProjectFirewallEndpoints": { + "methods": [ + "listProjectFirewallEndpoints", + "listProjectFirewallEndpointsStream", + "listProjectFirewallEndpointsAsync" + ] + }, "ListFirewallEndpointAssociations": { "methods": [ "listFirewallEndpointAssociations", @@ -1500,6 +1554,230 @@ } } } + }, + "SecurityProfileGroupService": { + "clients": { + "grpc": { + "libraryClient": "SecurityProfileGroupServiceClient", + "rpcs": { + "GetSecurityProfileGroup": { + "methods": [ + "getSecurityProfileGroup" + ] + }, + "GetSecurityProfile": { + "methods": [ + "getSecurityProfile" + ] + }, + "CreateSecurityProfileGroup": { + "methods": [ + "createSecurityProfileGroup" + ] + }, + "UpdateSecurityProfileGroup": { + "methods": [ + "updateSecurityProfileGroup" + ] + }, + "DeleteSecurityProfileGroup": { + "methods": [ + "deleteSecurityProfileGroup" + ] + }, + "CreateSecurityProfile": { + "methods": [ + "createSecurityProfile" + ] + }, + "UpdateSecurityProfile": { + "methods": [ + "updateSecurityProfile" + ] + }, + "DeleteSecurityProfile": { + "methods": [ + "deleteSecurityProfile" + ] + }, + "ListSecurityProfileGroups": { + "methods": [ + "listSecurityProfileGroups", + "listSecurityProfileGroupsStream", + "listSecurityProfileGroupsAsync" + ] + }, + "ListSecurityProfiles": { + "methods": [ + "listSecurityProfiles", + "listSecurityProfilesStream", + "listSecurityProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityProfileGroupServiceClient", + "rpcs": { + "GetSecurityProfileGroup": { + "methods": [ + "getSecurityProfileGroup" + ] + }, + "GetSecurityProfile": { + "methods": [ + "getSecurityProfile" + ] + }, + "CreateSecurityProfileGroup": { + "methods": [ + "createSecurityProfileGroup" + ] + }, + "UpdateSecurityProfileGroup": { + "methods": [ + "updateSecurityProfileGroup" + ] + }, + "DeleteSecurityProfileGroup": { + "methods": [ + "deleteSecurityProfileGroup" + ] + }, + "CreateSecurityProfile": { + "methods": [ + "createSecurityProfile" + ] + }, + "UpdateSecurityProfile": { + "methods": [ + "updateSecurityProfile" + ] + }, + "DeleteSecurityProfile": { + "methods": [ + "deleteSecurityProfile" + ] + }, + "ListSecurityProfileGroups": { + "methods": [ + "listSecurityProfileGroups", + "listSecurityProfileGroupsStream", + "listSecurityProfileGroupsAsync" + ] + }, + "ListSecurityProfiles": { + "methods": [ + "listSecurityProfiles", + "listSecurityProfilesStream", + "listSecurityProfilesAsync" + ] + } + } + } + } + }, + "SSERealmService": { + "clients": { + "grpc": { + "libraryClient": "SSERealmServiceClient", + "rpcs": { + "GetSACRealm": { + "methods": [ + "getSACRealm" + ] + }, + "GetSACAttachment": { + "methods": [ + "getSACAttachment" + ] + }, + "CreateSACRealm": { + "methods": [ + "createSACRealm" + ] + }, + "DeleteSACRealm": { + "methods": [ + "deleteSACRealm" + ] + }, + "CreateSACAttachment": { + "methods": [ + "createSACAttachment" + ] + }, + "DeleteSACAttachment": { + "methods": [ + "deleteSACAttachment" + ] + }, + "ListSACRealms": { + "methods": [ + "listSACRealms", + "listSACRealmsStream", + "listSACRealmsAsync" + ] + }, + "ListSACAttachments": { + "methods": [ + "listSACAttachments", + "listSACAttachmentsStream", + "listSACAttachmentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SSERealmServiceClient", + "rpcs": { + "GetSACRealm": { + "methods": [ + "getSACRealm" + ] + }, + "GetSACAttachment": { + "methods": [ + "getSACAttachment" + ] + }, + "CreateSACRealm": { + "methods": [ + "createSACRealm" + ] + }, + "DeleteSACRealm": { + "methods": [ + "deleteSACRealm" + ] + }, + "CreateSACAttachment": { + "methods": [ + "createSACAttachment" + ] + }, + "DeleteSACAttachment": { + "methods": [ + "deleteSACAttachment" + ] + }, + "ListSACRealms": { + "methods": [ + "listSACRealms", + "listSACRealmsStream", + "listSACRealmsAsync" + ] + }, + "ListSACAttachments": { + "methods": [ + "listSACAttachments", + "listSACAttachmentsStream", + "listSACAttachmentsAsync" + ] + } + } + } + } } } } diff --git a/packages/google-cloud-networksecurity/src/v1/index.ts b/packages/google-cloud-networksecurity/src/v1/index.ts index b096776375fc..e43de309484d 100644 --- a/packages/google-cloud-networksecurity/src/v1/index.ts +++ b/packages/google-cloud-networksecurity/src/v1/index.ts @@ -16,11 +16,13 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {AddressGroupServiceClient} from './address_group_service_client'; -export {DnsThreatDetectorServiceClient} from './dns_threat_detector_service_client'; -export {FirewallActivationClient} from './firewall_activation_client'; -export {InterceptClient} from './intercept_client'; -export {MirroringClient} from './mirroring_client'; -export {NetworkSecurityClient} from './network_security_client'; -export {OrganizationAddressGroupServiceClient} from './organization_address_group_service_client'; -export {OrganizationSecurityProfileGroupServiceClient} from './organization_security_profile_group_service_client'; +export { AddressGroupServiceClient } from './address_group_service_client'; +export { DnsThreatDetectorServiceClient } from './dns_threat_detector_service_client'; +export { FirewallActivationClient } from './firewall_activation_client'; +export { InterceptClient } from './intercept_client'; +export { MirroringClient } from './mirroring_client'; +export { NetworkSecurityClient } from './network_security_client'; +export { OrganizationAddressGroupServiceClient } from './organization_address_group_service_client'; +export { OrganizationSecurityProfileGroupServiceClient } from './organization_security_profile_group_service_client'; +export { SecurityProfileGroupServiceClient } from './security_profile_group_service_client'; +export { SSERealmServiceClient } from './s_s_e_realm_service_client'; diff --git a/packages/google-cloud-networksecurity/src/v1/intercept_client.ts b/packages/google-cloud-networksecurity/src/v1/intercept_client.ts index 5f49df914a24..c185f121a0be 100644 --- a/packages/google-cloud-networksecurity/src/v1/intercept_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/intercept_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +58,7 @@ export class InterceptClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -58,12 +71,12 @@ export class InterceptClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - interceptStub?: Promise<{[name: string]: Function}>; + interceptStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of InterceptClient. @@ -104,21 +117,42 @@ export class InterceptClient { * const client = new InterceptClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InterceptClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -143,7 +177,7 @@ export class InterceptClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -156,18 +190,14 @@ export class InterceptClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -189,97 +219,112 @@ export class InterceptClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), forwardingRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/forwardingRules/{forwarding_rule}' + 'projects/{project}/global/forwardingRules/{forwarding_rule}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -287,14 +332,27 @@ export class InterceptClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listInterceptEndpointGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptEndpointGroups'), + listInterceptEndpointGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptEndpointGroups', + ), listInterceptEndpointGroupAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptEndpointGroupAssociations'), - listInterceptDeploymentGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptDeploymentGroups'), - listInterceptDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptDeployments') + new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptEndpointGroupAssociations', + ), + listInterceptDeploymentGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptDeploymentGroups', + ), + listInterceptDeployments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptDeployments', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -303,126 +361,328 @@ export class InterceptClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptEndpointGroup', + ) as gax.protobuf.Type; const createInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptEndpointGroup', + ) as gax.protobuf.Type; const updateInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const createInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation') as gax.protobuf.Type; - const createInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const updateInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation') as gax.protobuf.Type; - const updateInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const createInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation', + ) as gax.protobuf.Type; + const createInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation', + ) as gax.protobuf.Type; + const updateInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup('.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptDeploymentGroup', + ) as gax.protobuf.Type; const createInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptDeploymentGroup', + ) as gax.protobuf.Type; const updateInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptDeployment', + ) as gax.protobuf.Type; const createInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.InterceptDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.InterceptDeployment', + ) as gax.protobuf.Type; const updateInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptEndpointGroupResponse.decode.bind(createInterceptEndpointGroupResponse), - createInterceptEndpointGroupMetadata.decode.bind(createInterceptEndpointGroupMetadata)), + createInterceptEndpointGroupResponse.decode.bind( + createInterceptEndpointGroupResponse, + ), + createInterceptEndpointGroupMetadata.decode.bind( + createInterceptEndpointGroupMetadata, + ), + ), updateInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptEndpointGroupResponse.decode.bind(updateInterceptEndpointGroupResponse), - updateInterceptEndpointGroupMetadata.decode.bind(updateInterceptEndpointGroupMetadata)), + updateInterceptEndpointGroupResponse.decode.bind( + updateInterceptEndpointGroupResponse, + ), + updateInterceptEndpointGroupMetadata.decode.bind( + updateInterceptEndpointGroupMetadata, + ), + ), deleteInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptEndpointGroupResponse.decode.bind(deleteInterceptEndpointGroupResponse), - deleteInterceptEndpointGroupMetadata.decode.bind(deleteInterceptEndpointGroupMetadata)), - createInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInterceptEndpointGroupAssociationResponse.decode.bind(createInterceptEndpointGroupAssociationResponse), - createInterceptEndpointGroupAssociationMetadata.decode.bind(createInterceptEndpointGroupAssociationMetadata)), - updateInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInterceptEndpointGroupAssociationResponse.decode.bind(updateInterceptEndpointGroupAssociationResponse), - updateInterceptEndpointGroupAssociationMetadata.decode.bind(updateInterceptEndpointGroupAssociationMetadata)), - deleteInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInterceptEndpointGroupAssociationResponse.decode.bind(deleteInterceptEndpointGroupAssociationResponse), - deleteInterceptEndpointGroupAssociationMetadata.decode.bind(deleteInterceptEndpointGroupAssociationMetadata)), + deleteInterceptEndpointGroupResponse.decode.bind( + deleteInterceptEndpointGroupResponse, + ), + deleteInterceptEndpointGroupMetadata.decode.bind( + deleteInterceptEndpointGroupMetadata, + ), + ), + createInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInterceptEndpointGroupAssociationResponse.decode.bind( + createInterceptEndpointGroupAssociationResponse, + ), + createInterceptEndpointGroupAssociationMetadata.decode.bind( + createInterceptEndpointGroupAssociationMetadata, + ), + ), + updateInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInterceptEndpointGroupAssociationResponse.decode.bind( + updateInterceptEndpointGroupAssociationResponse, + ), + updateInterceptEndpointGroupAssociationMetadata.decode.bind( + updateInterceptEndpointGroupAssociationMetadata, + ), + ), + deleteInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInterceptEndpointGroupAssociationResponse.decode.bind( + deleteInterceptEndpointGroupAssociationResponse, + ), + deleteInterceptEndpointGroupAssociationMetadata.decode.bind( + deleteInterceptEndpointGroupAssociationMetadata, + ), + ), createInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptDeploymentGroupResponse.decode.bind(createInterceptDeploymentGroupResponse), - createInterceptDeploymentGroupMetadata.decode.bind(createInterceptDeploymentGroupMetadata)), + createInterceptDeploymentGroupResponse.decode.bind( + createInterceptDeploymentGroupResponse, + ), + createInterceptDeploymentGroupMetadata.decode.bind( + createInterceptDeploymentGroupMetadata, + ), + ), updateInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptDeploymentGroupResponse.decode.bind(updateInterceptDeploymentGroupResponse), - updateInterceptDeploymentGroupMetadata.decode.bind(updateInterceptDeploymentGroupMetadata)), + updateInterceptDeploymentGroupResponse.decode.bind( + updateInterceptDeploymentGroupResponse, + ), + updateInterceptDeploymentGroupMetadata.decode.bind( + updateInterceptDeploymentGroupMetadata, + ), + ), deleteInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptDeploymentGroupResponse.decode.bind(deleteInterceptDeploymentGroupResponse), - deleteInterceptDeploymentGroupMetadata.decode.bind(deleteInterceptDeploymentGroupMetadata)), + deleteInterceptDeploymentGroupResponse.decode.bind( + deleteInterceptDeploymentGroupResponse, + ), + deleteInterceptDeploymentGroupMetadata.decode.bind( + deleteInterceptDeploymentGroupMetadata, + ), + ), createInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptDeploymentResponse.decode.bind(createInterceptDeploymentResponse), - createInterceptDeploymentMetadata.decode.bind(createInterceptDeploymentMetadata)), + createInterceptDeploymentResponse.decode.bind( + createInterceptDeploymentResponse, + ), + createInterceptDeploymentMetadata.decode.bind( + createInterceptDeploymentMetadata, + ), + ), updateInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptDeploymentResponse.decode.bind(updateInterceptDeploymentResponse), - updateInterceptDeploymentMetadata.decode.bind(updateInterceptDeploymentMetadata)), + updateInterceptDeploymentResponse.decode.bind( + updateInterceptDeploymentResponse, + ), + updateInterceptDeploymentMetadata.decode.bind( + updateInterceptDeploymentMetadata, + ), + ), deleteInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptDeploymentResponse.decode.bind(deleteInterceptDeploymentResponse), - deleteInterceptDeploymentMetadata.decode.bind(deleteInterceptDeploymentMetadata)) + deleteInterceptDeploymentResponse.decode.bind( + deleteInterceptDeploymentResponse, + ), + deleteInterceptDeploymentMetadata.decode.bind( + deleteInterceptDeploymentMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.Intercept', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.Intercept', + 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 @@ -453,28 +713,54 @@ export class InterceptClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.Intercept. this.interceptStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.Intercept') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.Intercept', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.networksecurity.v1.Intercept, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 interceptStubMethods = - ['listInterceptEndpointGroups', 'getInterceptEndpointGroup', 'createInterceptEndpointGroup', 'updateInterceptEndpointGroup', 'deleteInterceptEndpointGroup', 'listInterceptEndpointGroupAssociations', 'getInterceptEndpointGroupAssociation', 'createInterceptEndpointGroupAssociation', 'updateInterceptEndpointGroupAssociation', 'deleteInterceptEndpointGroupAssociation', 'listInterceptDeploymentGroups', 'getInterceptDeploymentGroup', 'createInterceptDeploymentGroup', 'updateInterceptDeploymentGroup', 'deleteInterceptDeploymentGroup', 'listInterceptDeployments', 'getInterceptDeployment', 'createInterceptDeployment', 'updateInterceptDeployment', 'deleteInterceptDeployment']; + const interceptStubMethods = [ + 'listInterceptEndpointGroups', + 'getInterceptEndpointGroup', + 'createInterceptEndpointGroup', + 'updateInterceptEndpointGroup', + 'deleteInterceptEndpointGroup', + 'listInterceptEndpointGroupAssociations', + 'getInterceptEndpointGroupAssociation', + 'createInterceptEndpointGroupAssociation', + 'updateInterceptEndpointGroupAssociation', + 'deleteInterceptEndpointGroupAssociation', + 'listInterceptDeploymentGroups', + 'getInterceptDeploymentGroup', + 'createInterceptDeploymentGroup', + 'updateInterceptDeploymentGroup', + 'deleteInterceptDeploymentGroup', + 'listInterceptDeployments', + 'getInterceptDeployment', + 'createInterceptDeployment', + 'updateInterceptDeployment', + 'deleteInterceptDeployment', + ]; for (const methodName of interceptStubMethods) { const callPromise = this.interceptStub.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) => () => { + (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] || @@ -484,7 +770,7 @@ export class InterceptClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -499,8 +785,14 @@ export class InterceptClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -511,8 +803,14 @@ export class InterceptClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -543,9 +841,7 @@ export class InterceptClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -554,8 +850,9 @@ export class InterceptClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -566,1883 +863,2932 @@ export class InterceptClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a specific endpoint group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint group to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group} - * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. - * 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/intercept.get_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_GetInterceptEndpointGroup_async - */ + /** + * Gets a specific endpoint group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint group to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group} + * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. + * 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/intercept.get_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_GetInterceptEndpointGroup_async + */ getInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptEndpointGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptEndpointGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptEndpointGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptEndpointGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific association. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the association to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association} - * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. - * 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/intercept.get_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_GetInterceptEndpointGroupAssociation_async - */ + /** + * Gets a specific association. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the association to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association} + * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. + * 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/intercept.get_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_GetInterceptEndpointGroupAssociation_async + */ getInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptEndpointGroupAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getInterceptEndpointGroupAssociation response %j', response); + this._log.info( + 'getInterceptEndpointGroupAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptEndpointGroupAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptEndpointGroupAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getInterceptEndpointGroupAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment group to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group} - * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. - * 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/intercept.get_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_GetInterceptDeploymentGroup_async - */ + /** + * Gets a specific deployment group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment group to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group} + * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. + * 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/intercept.get_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_GetInterceptDeploymentGroup_async + */ getInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptDeploymentGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptDeploymentGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptDeploymentGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptDeploymentGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment} - * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. - * 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/intercept.get_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_GetInterceptDeployment_async - */ + /** + * Gets a specific deployment. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment} + * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. + * 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/intercept.get_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_GetInterceptDeployment_async + */ getInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptDeployment request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptDeployment response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptDeployment response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptDeployment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an endpoint group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this endpoint group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptEndpointGroupId - * Required. The ID to use for the endpoint group, which will become the final - * component of the endpoint group's resource name. - * @param {google.cloud.networksecurity.v1.InterceptEndpointGroup} request.interceptEndpointGroup - * Required. The endpoint group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.create_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroup_async - */ + /** + * Creates an endpoint group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this endpoint group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptEndpointGroupId + * Required. The ID to use for the endpoint group, which will become the final + * component of the endpoint group's resource name. + * @param {google.cloud.networksecurity.v1.InterceptEndpointGroup} request.interceptEndpointGroup + * Required. The endpoint group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.create_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroup_async + */ createInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'createInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptEndpointGroup request %j', request); - return this.innerApiCalls.createInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptEndpointGroup()`. - * @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/intercept.create_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroup_async - */ - async checkCreateInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptEndpointGroup()`. + * @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/intercept.create_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroup_async + */ + async checkCreateInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates an endpoint group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the endpoint group - * (e.g. `description`; *not* `intercept_endpoint_group.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.InterceptEndpointGroup} request.interceptEndpointGroup - * Required. The endpoint group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.update_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroup_async - */ + /** + * Updates an endpoint group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the endpoint group + * (e.g. `description`; *not* `intercept_endpoint_group.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.InterceptEndpointGroup} request.interceptEndpointGroup + * Required. The endpoint group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.update_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroup_async + */ updateInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_endpoint_group.name': request.interceptEndpointGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_endpoint_group.name': + request.interceptEndpointGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'updateInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptEndpointGroup request %j', request); - return this.innerApiCalls.updateInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptEndpointGroup()`. - * @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/intercept.update_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroup_async - */ - async checkUpdateInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptEndpointGroup()`. + * @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/intercept.update_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroup_async + */ + async checkUpdateInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes an endpoint group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The endpoint group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.delete_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroup_async - */ + /** + * Deletes an endpoint group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The endpoint group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.delete_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroup_async + */ deleteInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'deleteInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptEndpointGroup request %j', request); - return this.innerApiCalls.deleteInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptEndpointGroup()`. - * @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/intercept.delete_intercept_endpoint_group.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroup_async - */ - async checkDeleteInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptEndpointGroup()`. + * @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/intercept.delete_intercept_endpoint_group.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroup_async + */ + async checkDeleteInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates an association in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this association will be created. - * Format: projects/{project}/locations/{location} - * @param {string} [request.interceptEndpointGroupAssociationId] - * Optional. The ID to use for the new association, which will become the - * final component of the endpoint group's resource name. If not provided, the - * server will generate a unique ID. - * @param {google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation - * Required. The association to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.create_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async - */ + /** + * Creates an association in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this association will be created. + * Format: projects/{project}/locations/{location} + * @param {string} [request.interceptEndpointGroupAssociationId] + * Optional. The ID to use for the new association, which will become the + * final component of the endpoint group's resource name. If not provided, the + * server will generate a unique ID. + * @param {google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation + * Required. The association to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.create_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async + */ createInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'createInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('createInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.createInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'createInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .createInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptEndpointGroupAssociation()`. - * @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/intercept.create_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async - */ - async checkCreateInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptEndpointGroupAssociation()`. + * @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/intercept.create_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async + */ + async checkCreateInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates an association. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the association - * (e.g. `description`; *not* - * `intercept_endpoint_group_association.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation - * Required. The association to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.update_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async - */ + /** + * Updates an association. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the association + * (e.g. `description`; *not* + * `intercept_endpoint_group_association.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation + * Required. The association to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.update_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async + */ updateInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_endpoint_group_association.name': request.interceptEndpointGroupAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_endpoint_group_association.name': + request.interceptEndpointGroupAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'updateInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('updateInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.updateInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'updateInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .updateInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptEndpointGroupAssociation()`. - * @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/intercept.update_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async - */ - async checkUpdateInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptEndpointGroupAssociation()`. + * @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/intercept.update_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async + */ + async checkUpdateInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes an association. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The association to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.delete_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async - */ + /** + * Deletes an association. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The association to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.delete_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async + */ deleteInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'deleteInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('deleteInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.deleteInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'deleteInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .deleteInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptEndpointGroupAssociation()`. - * @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/intercept.delete_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async - */ - async checkDeleteInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptEndpointGroupAssociation()`. + * @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/intercept.delete_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async + */ + async checkDeleteInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a deployment group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptDeploymentGroupId - * Required. The ID to use for the new deployment group, which will become the - * final component of the deployment group's resource name. - * @param {google.cloud.networksecurity.v1.InterceptDeploymentGroup} request.interceptDeploymentGroup - * Required. The deployment group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.create_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeploymentGroup_async - */ + /** + * Creates a deployment group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptDeploymentGroupId + * Required. The ID to use for the new deployment group, which will become the + * final component of the deployment group's resource name. + * @param {google.cloud.networksecurity.v1.InterceptDeploymentGroup} request.interceptDeploymentGroup + * Required. The deployment group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.create_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeploymentGroup_async + */ createInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'createInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.createInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptDeploymentGroup()`. - * @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/intercept.create_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeploymentGroup_async - */ - async checkCreateInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptDeploymentGroup()`. + * @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/intercept.create_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeploymentGroup_async + */ + async checkCreateInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates a deployment group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment group - * (e.g. `description`; *not* - * `intercept_deployment_group.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.InterceptDeploymentGroup} request.interceptDeploymentGroup - * Required. The deployment group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.update_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeploymentGroup_async - */ + /** + * Updates a deployment group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment group + * (e.g. `description`; *not* + * `intercept_deployment_group.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.InterceptDeploymentGroup} request.interceptDeploymentGroup + * Required. The deployment group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.update_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeploymentGroup_async + */ updateInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_deployment_group.name': request.interceptDeploymentGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_deployment_group.name': + request.interceptDeploymentGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'updateInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.updateInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptDeploymentGroup()`. - * @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/intercept.update_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeploymentGroup_async - */ - async checkUpdateInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptDeploymentGroup()`. + * @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/intercept.update_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeploymentGroup_async + */ + async checkUpdateInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a deployment group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.delete_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeploymentGroup_async - */ + /** + * Deletes a deployment group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.delete_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeploymentGroup_async + */ deleteInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'deleteInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.deleteInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptDeploymentGroup()`. - * @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/intercept.delete_intercept_deployment_group.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeploymentGroup_async - */ - async checkDeleteInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptDeploymentGroup()`. + * @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/intercept.delete_intercept_deployment_group.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeploymentGroup_async + */ + async checkDeleteInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a deployment in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptDeploymentId - * Required. The ID to use for the new deployment, which will become the final - * component of the deployment's resource name. - * @param {google.cloud.networksecurity.v1.InterceptDeployment} request.interceptDeployment - * Required. The deployment to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.create_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeployment_async - */ + /** + * Creates a deployment in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptDeploymentId + * Required. The ID to use for the new deployment, which will become the final + * component of the deployment's resource name. + * @param {google.cloud.networksecurity.v1.InterceptDeployment} request.interceptDeployment + * Required. The deployment to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.create_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeployment_async + */ createInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptDeployment request %j', request); - return this.innerApiCalls.createInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptDeployment()`. - * @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/intercept.create_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeployment_async - */ - async checkCreateInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptDeployment()`. + * @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/intercept.create_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_CreateInterceptDeployment_async + */ + async checkCreateInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates a deployment. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment - * (e.g. `description`; *not* `intercept_deployment.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.InterceptDeployment} request.interceptDeployment - * Required. The deployment to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.update_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeployment_async - */ + /** + * Updates a deployment. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment + * (e.g. `description`; *not* `intercept_deployment.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.InterceptDeployment} request.interceptDeployment + * Required. The deployment to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.update_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeployment_async + */ updateInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_deployment.name': request.interceptDeployment!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_deployment.name': request.interceptDeployment!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptDeployment request %j', request); - return this.innerApiCalls.updateInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptDeployment()`. - * @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/intercept.update_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeployment_async - */ - async checkUpdateInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptDeployment()`. + * @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/intercept.update_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_UpdateInterceptDeployment_async + */ + async checkUpdateInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.InterceptDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a deployment. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/intercept.delete_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeployment_async - */ + /** + * Deletes a deployment. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/intercept.delete_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeployment_async + */ deleteInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeployment( - request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptDeployment request %j', request); - return this.innerApiCalls.deleteInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptDeployment()`. - * @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/intercept.delete_intercept_deployment.js - * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeployment_async - */ - async checkDeleteInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptDeployment()`. + * @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/intercept.delete_intercept_deployment.js + * region_tag:networksecurity_v1_generated_Intercept_DeleteInterceptDeployment_async + */ + async checkDeleteInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists endpoint groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. - * 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 `listInterceptEndpointGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists endpoint groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. + * 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 `listInterceptEndpointGroupsAsync()` + * 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. + */ listInterceptEndpointGroups( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse, + ] + >; listInterceptEndpointGroups( - request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup + >, + ): void; listInterceptEndpointGroups( - request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup + >, + ): void; listInterceptEndpointGroups( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptEndpointGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2451,468 +3797,540 @@ export class InterceptClient { this._log.info('listInterceptEndpointGroups request %j', request); return this.innerApiCalls .listInterceptEndpointGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse - ]) => { - this._log.info('listInterceptEndpointGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsResponse, + ]) => { + this._log.info('listInterceptEndpointGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptEndpointGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup} 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 `listInterceptEndpointGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptEndpointGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup} 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 `listInterceptEndpointGroupsAsync()` + * 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. + */ listInterceptEndpointGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroups stream %j', request); return this.descriptors.page.listInterceptEndpointGroups.createStream( this.innerApiCalls.listInterceptEndpointGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptEndpointGroups`, 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, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. 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/intercept.list_intercept_endpoint_groups.js - * region_tag:networksecurity_v1_generated_Intercept_ListInterceptEndpointGroups_async - */ + /** + * Equivalent to `listInterceptEndpointGroups`, 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, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroup|InterceptEndpointGroup}. 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/intercept.list_intercept_endpoint_groups.js + * region_tag:networksecurity_v1_generated_Intercept_ListInterceptEndpointGroups_async + */ listInterceptEndpointGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroups iterate %j', request); return this.descriptors.page.listInterceptEndpointGroups.asyncIterate( this.innerApiCalls['listInterceptEndpointGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists associations in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. - * 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 `listInterceptEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Lists associations in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. + * 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 `listInterceptEndpointGroupAssociationsAsync()` + * 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. + */ listInterceptEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse, + ] + >; listInterceptEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation + >, + ): void; listInterceptEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation + >, + ): void; listInterceptEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInterceptEndpointGroupAssociations values %j', values); + this._log.info( + 'listInterceptEndpointGroupAssociations values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listInterceptEndpointGroupAssociations request %j', request); + this._log.info( + 'listInterceptEndpointGroupAssociations request %j', + request, + ); return this.innerApiCalls .listInterceptEndpointGroupAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse - ]) => { - this._log.info('listInterceptEndpointGroupAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsResponse, + ]) => { + this._log.info( + 'listInterceptEndpointGroupAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptEndpointGroupAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation} 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 `listInterceptEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptEndpointGroupAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation} 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 `listInterceptEndpointGroupAssociationsAsync()` + * 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. + */ listInterceptEndpointGroupAssociationsStream( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + 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['listInterceptEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listInterceptEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroupAssociations stream %j', request); return this.descriptors.page.listInterceptEndpointGroupAssociations.createStream( this.innerApiCalls.listInterceptEndpointGroupAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptEndpointGroupAssociations`, 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, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. 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/intercept.list_intercept_endpoint_group_associations.js - * region_tag:networksecurity_v1_generated_Intercept_ListInterceptEndpointGroupAssociations_async - */ + /** + * Equivalent to `listInterceptEndpointGroupAssociations`, 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, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. 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/intercept.list_intercept_endpoint_group_associations.js + * region_tag:networksecurity_v1_generated_Intercept_ListInterceptEndpointGroupAssociations_async + */ listInterceptEndpointGroupAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptEndpointGroupAssociationsRequest, + 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['listInterceptEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listInterceptEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInterceptEndpointGroupAssociations iterate %j', request); + this.initialize().catch((err) => { + throw err; + }); + this._log.info( + 'listInterceptEndpointGroupAssociations iterate %j', + request, + ); return this.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate( this.innerApiCalls['listInterceptEndpointGroupAssociations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployment groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. - * 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 `listInterceptDeploymentGroupsAsync()` - * 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. - */ + /** + * Lists deployment groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. + * 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 `listInterceptDeploymentGroupsAsync()` + * 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. + */ listInterceptDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse, + ] + >; listInterceptDeploymentGroups( - request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup + >, + ): void; listInterceptDeploymentGroups( - request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup + >, + ): void; listInterceptDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptDeploymentGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2921,232 +4339,261 @@ export class InterceptClient { this._log.info('listInterceptDeploymentGroups request %j', request); return this.innerApiCalls .listInterceptDeploymentGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse - ]) => { - this._log.info('listInterceptDeploymentGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsResponse, + ]) => { + this._log.info('listInterceptDeploymentGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptDeploymentGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup} 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 `listInterceptDeploymentGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptDeploymentGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup} 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 `listInterceptDeploymentGroupsAsync()` + * 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. + */ listInterceptDeploymentGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeploymentGroups stream %j', request); return this.descriptors.page.listInterceptDeploymentGroups.createStream( this.innerApiCalls.listInterceptDeploymentGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptDeploymentGroups`, 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, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. 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/intercept.list_intercept_deployment_groups.js - * region_tag:networksecurity_v1_generated_Intercept_ListInterceptDeploymentGroups_async - */ + /** + * Equivalent to `listInterceptDeploymentGroups`, 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, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeploymentGroup|InterceptDeploymentGroup}. 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/intercept.list_intercept_deployment_groups.js + * region_tag:networksecurity_v1_generated_Intercept_ListInterceptDeploymentGroups_async + */ listInterceptDeploymentGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeploymentGroups iterate %j', request); return this.descriptors.page.listInterceptDeploymentGroups.asyncIterate( this.innerApiCalls['listInterceptDeploymentGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployments in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. - * 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 `listInterceptDeploymentsAsync()` - * 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. - */ + /** + * Lists deployments in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. + * 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 `listInterceptDeploymentsAsync()` + * 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. + */ listInterceptDeployments( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse, + ] + >; listInterceptDeployments( - request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeployment>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeployment + >, + ): void; listInterceptDeployments( - request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeployment>): void; + request: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeployment + >, + ): void; listInterceptDeployments( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeployment>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeployment>): - Promise<[ - protos.google.cloud.networksecurity.v1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeployment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeployment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IInterceptDeployment>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IInterceptDeployment + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptDeployments values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3155,161 +4602,165 @@ export class InterceptClient { this._log.info('listInterceptDeployments request %j', request); return this.innerApiCalls .listInterceptDeployments(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse - ]) => { - this._log.info('listInterceptDeployments values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsResponse, + ]) => { + this._log.info('listInterceptDeployments values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptDeployments`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment} 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 `listInterceptDeploymentsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptDeployments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment} 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 `listInterceptDeploymentsAsync()` + * 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. + */ listInterceptDeploymentsStream( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeployments stream %j', request); return this.descriptors.page.listInterceptDeployments.createStream( this.innerApiCalls.listInterceptDeployments as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptDeployments`, 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, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. 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/intercept.list_intercept_deployments.js - * region_tag:networksecurity_v1_generated_Intercept_ListInterceptDeployments_async - */ + /** + * Equivalent to `listInterceptDeployments`, 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, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.InterceptDeployment|InterceptDeployment}. 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/intercept.list_intercept_deployments.js + * region_tag:networksecurity_v1_generated_Intercept_ListInterceptDeployments_async + */ listInterceptDeploymentsAsync( - request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListInterceptDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeployments iterate %j', request); return this.descriptors.page.listInterceptDeployments.asyncIterate( this.innerApiCalls['listInterceptDeployments'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -3323,40 +4774,40 @@ export class InterceptClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -3370,41 +4821,41 @@ export class InterceptClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -3418,12 +4869,12 @@ export class InterceptClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3458,12 +4909,11 @@ export class InterceptClient { | 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. @@ -3496,12 +4946,12 @@ export class InterceptClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -3544,22 +4994,22 @@ export class InterceptClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3594,15 +5044,15 @@ export class InterceptClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3636,7 +5086,7 @@ export class InterceptClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3649,25 +5099,24 @@ export class InterceptClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -3706,22 +5155,22 @@ export class InterceptClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -3737,7 +5186,11 @@ export class InterceptClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -3753,7 +5206,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -3764,7 +5219,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -3774,8 +5231,12 @@ export class InterceptClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -3786,7 +5247,7 @@ export class InterceptClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -3802,7 +5263,8 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -3813,7 +5275,8 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -3824,7 +5287,8 @@ export class InterceptClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -3835,7 +5299,11 @@ export class InterceptClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -3850,8 +5318,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -3861,8 +5333,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -3872,8 +5348,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -3884,7 +5364,11 @@ export class InterceptClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3900,7 +5384,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -3911,7 +5397,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -3922,7 +5410,9 @@ export class InterceptClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -3933,7 +5423,11 @@ export class InterceptClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -3949,7 +5443,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -3960,7 +5456,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -3970,8 +5468,12 @@ export class InterceptClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -3982,7 +5484,11 @@ export class InterceptClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -3997,8 +5503,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -4008,8 +5518,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -4019,8 +5533,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -4030,7 +5548,7 @@ export class InterceptClient { * @param {string} forwarding_rule * @returns {string} Resource name string. */ - forwardingRulePath(project:string,forwardingRule:string) { + forwardingRulePath(project: string, forwardingRule: string) { return this.pathTemplates.forwardingRulePathTemplate.render({ project: project, forwarding_rule: forwardingRule, @@ -4045,7 +5563,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).project; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).project; } /** @@ -4056,7 +5576,9 @@ export class InterceptClient { * @returns {string} A string representing the forwarding_rule. */ matchForwardingRuleFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).forwarding_rule; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).forwarding_rule; } /** @@ -4067,7 +5589,11 @@ export class InterceptClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -4083,7 +5609,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -4093,8 +5621,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -4104,8 +5636,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -4117,7 +5653,12 @@ export class InterceptClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -4133,8 +5674,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -4144,8 +5689,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -4155,8 +5704,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -4166,8 +5719,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -4178,7 +5735,11 @@ export class InterceptClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -4194,7 +5755,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -4205,7 +5768,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -4215,8 +5780,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -4227,7 +5796,11 @@ export class InterceptClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4242,8 +5815,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -4253,8 +5830,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -4264,8 +5845,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -4276,7 +5861,11 @@ export class InterceptClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4291,8 +5880,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -4302,8 +5895,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -4313,8 +5910,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -4325,12 +5926,18 @@ export class InterceptClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -4340,8 +5947,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -4351,8 +5962,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -4362,8 +5977,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -4373,7 +5992,7 @@ export class InterceptClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4410,7 +6029,11 @@ export class InterceptClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -4426,7 +6049,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -4437,7 +6062,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -4447,8 +6074,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -4459,7 +6090,11 @@ export class InterceptClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4474,8 +6109,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -4485,8 +6124,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -4496,8 +6139,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -4508,7 +6155,11 @@ export class InterceptClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4523,8 +6174,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -4534,8 +6189,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -4545,8 +6204,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -4557,12 +6220,18 @@ export class InterceptClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -4572,8 +6241,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -4583,8 +6256,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -4594,8 +6271,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -4605,7 +6286,7 @@ export class InterceptClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -4642,12 +6323,18 @@ export class InterceptClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -4657,8 +6344,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -4668,8 +6359,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -4679,8 +6374,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -4691,12 +6390,18 @@ export class InterceptClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4706,8 +6411,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -4717,8 +6426,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -4728,8 +6441,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4740,12 +6457,18 @@ export class InterceptClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4755,8 +6478,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -4766,8 +6493,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -4777,8 +6508,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -4789,12 +6524,18 @@ export class InterceptClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -4804,8 +6545,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -4815,8 +6560,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -4826,8 +6575,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -4836,7 +6589,7 @@ export class InterceptClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -4861,7 +6614,11 @@ export class InterceptClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -4876,8 +6633,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -4887,8 +6648,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -4898,8 +6663,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -4910,12 +6679,18 @@ export class InterceptClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4925,8 +6700,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -4936,8 +6715,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -4947,8 +6730,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4959,12 +6746,18 @@ export class InterceptClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4974,8 +6767,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -4985,8 +6782,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -4996,8 +6797,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -5008,12 +6813,18 @@ export class InterceptClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -5023,8 +6834,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -5034,8 +6849,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -5045,8 +6864,114 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -5057,7 +6982,11 @@ export class InterceptClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -5073,7 +7002,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -5084,7 +7015,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -5095,7 +7028,9 @@ export class InterceptClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -5106,7 +7041,11 @@ export class InterceptClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -5122,7 +7061,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -5133,7 +7074,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -5143,8 +7086,12 @@ export class InterceptClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -5155,7 +7102,7 @@ export class InterceptClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -5204,15 +7151,19 @@ export class InterceptClient { */ close(): Promise { if (this.interceptStub && !this._terminated) { - return this.interceptStub.then(stub => { + return this.interceptStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/intercept_proto_list.json b/packages/google-cloud-networksecurity/src/v1/intercept_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/intercept_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/intercept_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/mirroring_client.ts b/packages/google-cloud-networksecurity/src/v1/mirroring_client.ts index a53271050cd1..41d64ab1e198 100644 --- a/packages/google-cloud-networksecurity/src/v1/mirroring_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/mirroring_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class MirroringClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class MirroringClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - mirroringStub?: Promise<{[name: string]: Function}>; + mirroringStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of MirroringClient. @@ -103,21 +116,42 @@ export class MirroringClient { * const client = new MirroringClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof MirroringClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class MirroringClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class MirroringClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,97 +218,112 @@ export class MirroringClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), forwardingRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/forwardingRules/{forwarding_rule}' + 'projects/{project}/global/forwardingRules/{forwarding_rule}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -286,14 +331,27 @@ export class MirroringClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listMirroringEndpointGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringEndpointGroups'), + listMirroringEndpointGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringEndpointGroups', + ), listMirroringEndpointGroupAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringEndpointGroupAssociations'), - listMirroringDeploymentGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringDeploymentGroups'), - listMirroringDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringDeployments') + new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringEndpointGroupAssociations', + ), + listMirroringDeploymentGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringDeploymentGroups', + ), + listMirroringDeployments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringDeployments', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -302,126 +360,328 @@ export class MirroringClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringEndpointGroup', + ) as gax.protobuf.Type; const createMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringEndpointGroup', + ) as gax.protobuf.Type; const updateMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const createMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation') as gax.protobuf.Type; - const createMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const updateMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation') as gax.protobuf.Type; - const updateMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const createMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation', + ) as gax.protobuf.Type; + const createMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation', + ) as gax.protobuf.Type; + const updateMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup('.google.protobuf.Empty') as gax.protobuf.Type; + const deleteMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringDeploymentGroup', + ) as gax.protobuf.Type; const createMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringDeploymentGroup', + ) as gax.protobuf.Type; const updateMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringDeployment', + ) as gax.protobuf.Type; const createMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.MirroringDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.MirroringDeployment', + ) as gax.protobuf.Type; const updateMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringEndpointGroupResponse.decode.bind(createMirroringEndpointGroupResponse), - createMirroringEndpointGroupMetadata.decode.bind(createMirroringEndpointGroupMetadata)), + createMirroringEndpointGroupResponse.decode.bind( + createMirroringEndpointGroupResponse, + ), + createMirroringEndpointGroupMetadata.decode.bind( + createMirroringEndpointGroupMetadata, + ), + ), updateMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringEndpointGroupResponse.decode.bind(updateMirroringEndpointGroupResponse), - updateMirroringEndpointGroupMetadata.decode.bind(updateMirroringEndpointGroupMetadata)), + updateMirroringEndpointGroupResponse.decode.bind( + updateMirroringEndpointGroupResponse, + ), + updateMirroringEndpointGroupMetadata.decode.bind( + updateMirroringEndpointGroupMetadata, + ), + ), deleteMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringEndpointGroupResponse.decode.bind(deleteMirroringEndpointGroupResponse), - deleteMirroringEndpointGroupMetadata.decode.bind(deleteMirroringEndpointGroupMetadata)), - createMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMirroringEndpointGroupAssociationResponse.decode.bind(createMirroringEndpointGroupAssociationResponse), - createMirroringEndpointGroupAssociationMetadata.decode.bind(createMirroringEndpointGroupAssociationMetadata)), - updateMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMirroringEndpointGroupAssociationResponse.decode.bind(updateMirroringEndpointGroupAssociationResponse), - updateMirroringEndpointGroupAssociationMetadata.decode.bind(updateMirroringEndpointGroupAssociationMetadata)), - deleteMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteMirroringEndpointGroupAssociationResponse.decode.bind(deleteMirroringEndpointGroupAssociationResponse), - deleteMirroringEndpointGroupAssociationMetadata.decode.bind(deleteMirroringEndpointGroupAssociationMetadata)), + deleteMirroringEndpointGroupResponse.decode.bind( + deleteMirroringEndpointGroupResponse, + ), + deleteMirroringEndpointGroupMetadata.decode.bind( + deleteMirroringEndpointGroupMetadata, + ), + ), + createMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMirroringEndpointGroupAssociationResponse.decode.bind( + createMirroringEndpointGroupAssociationResponse, + ), + createMirroringEndpointGroupAssociationMetadata.decode.bind( + createMirroringEndpointGroupAssociationMetadata, + ), + ), + updateMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMirroringEndpointGroupAssociationResponse.decode.bind( + updateMirroringEndpointGroupAssociationResponse, + ), + updateMirroringEndpointGroupAssociationMetadata.decode.bind( + updateMirroringEndpointGroupAssociationMetadata, + ), + ), + deleteMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteMirroringEndpointGroupAssociationResponse.decode.bind( + deleteMirroringEndpointGroupAssociationResponse, + ), + deleteMirroringEndpointGroupAssociationMetadata.decode.bind( + deleteMirroringEndpointGroupAssociationMetadata, + ), + ), createMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringDeploymentGroupResponse.decode.bind(createMirroringDeploymentGroupResponse), - createMirroringDeploymentGroupMetadata.decode.bind(createMirroringDeploymentGroupMetadata)), + createMirroringDeploymentGroupResponse.decode.bind( + createMirroringDeploymentGroupResponse, + ), + createMirroringDeploymentGroupMetadata.decode.bind( + createMirroringDeploymentGroupMetadata, + ), + ), updateMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringDeploymentGroupResponse.decode.bind(updateMirroringDeploymentGroupResponse), - updateMirroringDeploymentGroupMetadata.decode.bind(updateMirroringDeploymentGroupMetadata)), + updateMirroringDeploymentGroupResponse.decode.bind( + updateMirroringDeploymentGroupResponse, + ), + updateMirroringDeploymentGroupMetadata.decode.bind( + updateMirroringDeploymentGroupMetadata, + ), + ), deleteMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringDeploymentGroupResponse.decode.bind(deleteMirroringDeploymentGroupResponse), - deleteMirroringDeploymentGroupMetadata.decode.bind(deleteMirroringDeploymentGroupMetadata)), + deleteMirroringDeploymentGroupResponse.decode.bind( + deleteMirroringDeploymentGroupResponse, + ), + deleteMirroringDeploymentGroupMetadata.decode.bind( + deleteMirroringDeploymentGroupMetadata, + ), + ), createMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringDeploymentResponse.decode.bind(createMirroringDeploymentResponse), - createMirroringDeploymentMetadata.decode.bind(createMirroringDeploymentMetadata)), + createMirroringDeploymentResponse.decode.bind( + createMirroringDeploymentResponse, + ), + createMirroringDeploymentMetadata.decode.bind( + createMirroringDeploymentMetadata, + ), + ), updateMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringDeploymentResponse.decode.bind(updateMirroringDeploymentResponse), - updateMirroringDeploymentMetadata.decode.bind(updateMirroringDeploymentMetadata)), + updateMirroringDeploymentResponse.decode.bind( + updateMirroringDeploymentResponse, + ), + updateMirroringDeploymentMetadata.decode.bind( + updateMirroringDeploymentMetadata, + ), + ), deleteMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringDeploymentResponse.decode.bind(deleteMirroringDeploymentResponse), - deleteMirroringDeploymentMetadata.decode.bind(deleteMirroringDeploymentMetadata)) + deleteMirroringDeploymentResponse.decode.bind( + deleteMirroringDeploymentResponse, + ), + deleteMirroringDeploymentMetadata.decode.bind( + deleteMirroringDeploymentMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.Mirroring', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.Mirroring', + 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 @@ -452,28 +712,54 @@ export class MirroringClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.Mirroring. this.mirroringStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.Mirroring') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.Mirroring', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.networksecurity.v1.Mirroring, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 mirroringStubMethods = - ['listMirroringEndpointGroups', 'getMirroringEndpointGroup', 'createMirroringEndpointGroup', 'updateMirroringEndpointGroup', 'deleteMirroringEndpointGroup', 'listMirroringEndpointGroupAssociations', 'getMirroringEndpointGroupAssociation', 'createMirroringEndpointGroupAssociation', 'updateMirroringEndpointGroupAssociation', 'deleteMirroringEndpointGroupAssociation', 'listMirroringDeploymentGroups', 'getMirroringDeploymentGroup', 'createMirroringDeploymentGroup', 'updateMirroringDeploymentGroup', 'deleteMirroringDeploymentGroup', 'listMirroringDeployments', 'getMirroringDeployment', 'createMirroringDeployment', 'updateMirroringDeployment', 'deleteMirroringDeployment']; + const mirroringStubMethods = [ + 'listMirroringEndpointGroups', + 'getMirroringEndpointGroup', + 'createMirroringEndpointGroup', + 'updateMirroringEndpointGroup', + 'deleteMirroringEndpointGroup', + 'listMirroringEndpointGroupAssociations', + 'getMirroringEndpointGroupAssociation', + 'createMirroringEndpointGroupAssociation', + 'updateMirroringEndpointGroupAssociation', + 'deleteMirroringEndpointGroupAssociation', + 'listMirroringDeploymentGroups', + 'getMirroringDeploymentGroup', + 'createMirroringDeploymentGroup', + 'updateMirroringDeploymentGroup', + 'deleteMirroringDeploymentGroup', + 'listMirroringDeployments', + 'getMirroringDeployment', + 'createMirroringDeployment', + 'updateMirroringDeployment', + 'deleteMirroringDeployment', + ]; for (const methodName of mirroringStubMethods) { const callPromise = this.mirroringStub.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) => () => { + (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] || @@ -483,7 +769,7 @@ export class MirroringClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -498,8 +784,14 @@ export class MirroringClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -510,8 +802,14 @@ export class MirroringClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -542,9 +840,7 @@ export class MirroringClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -553,8 +849,9 @@ export class MirroringClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -565,1883 +862,2932 @@ export class MirroringClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a specific endpoint group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint group to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group} - * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. - * 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/mirroring.get_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringEndpointGroup_async - */ + /** + * Gets a specific endpoint group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint group to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group} + * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. + * 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/mirroring.get_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringEndpointGroup_async + */ getMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringEndpointGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringEndpointGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringEndpointGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringEndpointGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific association. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the association to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association} - * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. - * 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/mirroring.get_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringEndpointGroupAssociation_async - */ + /** + * Gets a specific association. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the association to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association} + * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. + * 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/mirroring.get_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringEndpointGroupAssociation_async + */ getMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringEndpointGroupAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getMirroringEndpointGroupAssociation response %j', response); + this._log.info( + 'getMirroringEndpointGroupAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringEndpointGroupAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringEndpointGroupAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getMirroringEndpointGroupAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment group to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group} - * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. - * 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/mirroring.get_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringDeploymentGroup_async - */ + /** + * Gets a specific deployment group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment group to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group} + * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. + * 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/mirroring.get_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringDeploymentGroup_async + */ getMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringDeploymentGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringDeploymentGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringDeploymentGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringDeploymentGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment} - * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. - * 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/mirroring.get_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringDeployment_async - */ + /** + * Gets a specific deployment. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment} + * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. + * 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/mirroring.get_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_GetMirroringDeployment_async + */ getMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringDeployment request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringDeployment response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringDeployment response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringDeployment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an endpoint group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this endpoint group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringEndpointGroupId - * Required. The ID to use for the endpoint group, which will become the final - * component of the endpoint group's resource name. - * @param {google.cloud.networksecurity.v1.MirroringEndpointGroup} request.mirroringEndpointGroup - * Required. The endpoint group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.create_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroup_async - */ + /** + * Creates an endpoint group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this endpoint group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringEndpointGroupId + * Required. The ID to use for the endpoint group, which will become the final + * component of the endpoint group's resource name. + * @param {google.cloud.networksecurity.v1.MirroringEndpointGroup} request.mirroringEndpointGroup + * Required. The endpoint group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.create_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroup_async + */ createMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'createMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringEndpointGroup request %j', request); - return this.innerApiCalls.createMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringEndpointGroup()`. - * @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/mirroring.create_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroup_async - */ - async checkCreateMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringEndpointGroup()`. + * @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/mirroring.create_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroup_async + */ + async checkCreateMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates an endpoint group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the endpoint group - * (e.g. `description`; *not* `mirroring_endpoint_group.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.MirroringEndpointGroup} request.mirroringEndpointGroup - * Required. The endpoint group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.update_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroup_async - */ + /** + * Updates an endpoint group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the endpoint group + * (e.g. `description`; *not* `mirroring_endpoint_group.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.MirroringEndpointGroup} request.mirroringEndpointGroup + * Required. The endpoint group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.update_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroup_async + */ updateMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_endpoint_group.name': request.mirroringEndpointGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_endpoint_group.name': + request.mirroringEndpointGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'updateMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringEndpointGroup request %j', request); - return this.innerApiCalls.updateMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringEndpointGroup()`. - * @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/mirroring.update_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroup_async - */ - async checkUpdateMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringEndpointGroup()`. + * @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/mirroring.update_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroup_async + */ + async checkUpdateMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes an endpoint group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The endpoint group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.delete_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroup_async - */ + /** + * Deletes an endpoint group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The endpoint group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.delete_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroup_async + */ deleteMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'deleteMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringEndpointGroup request %j', request); - return this.innerApiCalls.deleteMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringEndpointGroup()`. - * @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/mirroring.delete_mirroring_endpoint_group.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroup_async - */ - async checkDeleteMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringEndpointGroup()`. + * @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/mirroring.delete_mirroring_endpoint_group.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroup_async + */ + async checkDeleteMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates an association in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this association will be created. - * Format: projects/{project}/locations/{location} - * @param {string} [request.mirroringEndpointGroupAssociationId] - * Optional. The ID to use for the new association, which will become the - * final component of the endpoint group's resource name. If not provided, the - * server will generate a unique ID. - * @param {google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation - * Required. The association to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.create_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async - */ + /** + * Creates an association in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this association will be created. + * Format: projects/{project}/locations/{location} + * @param {string} [request.mirroringEndpointGroupAssociationId] + * Optional. The ID to use for the new association, which will become the + * final component of the endpoint group's resource name. If not provided, the + * server will generate a unique ID. + * @param {google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation + * Required. The association to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.create_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async + */ createMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'createMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('createMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.createMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'createMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .createMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringEndpointGroupAssociation()`. - * @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/mirroring.create_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async - */ - async checkCreateMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringEndpointGroupAssociation()`. + * @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/mirroring.create_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async + */ + async checkCreateMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates an association. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the association - * (e.g. `description`; *not* - * `mirroring_endpoint_group_association.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation - * Required. The association to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.update_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async - */ + /** + * Updates an association. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the association + * (e.g. `description`; *not* + * `mirroring_endpoint_group_association.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation + * Required. The association to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.update_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async + */ updateMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_endpoint_group_association.name': request.mirroringEndpointGroupAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_endpoint_group_association.name': + request.mirroringEndpointGroupAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'updateMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('updateMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.updateMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'updateMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .updateMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringEndpointGroupAssociation()`. - * @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/mirroring.update_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async - */ - async checkUpdateMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringEndpointGroupAssociation()`. + * @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/mirroring.update_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async + */ + async checkUpdateMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes an association. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The association to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.delete_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async - */ + /** + * Deletes an association. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The association to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.delete_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async + */ deleteMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'deleteMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('deleteMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.deleteMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'deleteMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .deleteMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringEndpointGroupAssociation()`. - * @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/mirroring.delete_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async - */ - async checkDeleteMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringEndpointGroupAssociation()`. + * @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/mirroring.delete_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async + */ + async checkDeleteMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a deployment group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringDeploymentGroupId - * Required. The ID to use for the new deployment group, which will become the - * final component of the deployment group's resource name. - * @param {google.cloud.networksecurity.v1.MirroringDeploymentGroup} request.mirroringDeploymentGroup - * Required. The deployment group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.create_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeploymentGroup_async - */ + /** + * Creates a deployment group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringDeploymentGroupId + * Required. The ID to use for the new deployment group, which will become the + * final component of the deployment group's resource name. + * @param {google.cloud.networksecurity.v1.MirroringDeploymentGroup} request.mirroringDeploymentGroup + * Required. The deployment group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.create_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeploymentGroup_async + */ createMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'createMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.createMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringDeploymentGroup()`. - * @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/mirroring.create_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeploymentGroup_async - */ - async checkCreateMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringDeploymentGroup()`. + * @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/mirroring.create_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeploymentGroup_async + */ + async checkCreateMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates a deployment group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment group - * (e.g. `description`; *not* - * `mirroring_deployment_group.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.MirroringDeploymentGroup} request.mirroringDeploymentGroup - * Required. The deployment group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.update_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeploymentGroup_async - */ + /** + * Updates a deployment group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment group + * (e.g. `description`; *not* + * `mirroring_deployment_group.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.MirroringDeploymentGroup} request.mirroringDeploymentGroup + * Required. The deployment group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.update_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeploymentGroup_async + */ updateMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_deployment_group.name': request.mirroringDeploymentGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_deployment_group.name': + request.mirroringDeploymentGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'updateMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.updateMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringDeploymentGroup()`. - * @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/mirroring.update_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeploymentGroup_async - */ - async checkUpdateMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringDeploymentGroup()`. + * @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/mirroring.update_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeploymentGroup_async + */ + async checkUpdateMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a deployment group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.delete_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeploymentGroup_async - */ + /** + * Deletes a deployment group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.delete_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeploymentGroup_async + */ deleteMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'deleteMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.deleteMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringDeploymentGroup()`. - * @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/mirroring.delete_mirroring_deployment_group.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeploymentGroup_async - */ - async checkDeleteMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringDeploymentGroup()`. + * @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/mirroring.delete_mirroring_deployment_group.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeploymentGroup_async + */ + async checkDeleteMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a deployment in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringDeploymentId - * Required. The ID to use for the new deployment, which will become the final - * component of the deployment's resource name. - * @param {google.cloud.networksecurity.v1.MirroringDeployment} request.mirroringDeployment - * Required. The deployment to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.create_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeployment_async - */ + /** + * Creates a deployment in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringDeploymentId + * Required. The ID to use for the new deployment, which will become the final + * component of the deployment's resource name. + * @param {google.cloud.networksecurity.v1.MirroringDeployment} request.mirroringDeployment + * Required. The deployment to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.create_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeployment_async + */ createMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringDeployment request %j', request); - return this.innerApiCalls.createMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringDeployment()`. - * @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/mirroring.create_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeployment_async - */ - async checkCreateMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringDeployment()`. + * @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/mirroring.create_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_CreateMirroringDeployment_async + */ + async checkCreateMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates a deployment. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment - * (e.g. `description`; *not* `mirroring_deployment.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1.MirroringDeployment} request.mirroringDeployment - * Required. The deployment to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.update_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeployment_async - */ + /** + * Updates a deployment. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment + * (e.g. `description`; *not* `mirroring_deployment.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1.MirroringDeployment} request.mirroringDeployment + * Required. The deployment to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.update_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeployment_async + */ updateMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_deployment.name': request.mirroringDeployment!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_deployment.name': request.mirroringDeployment!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringDeployment request %j', request); - return this.innerApiCalls.updateMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringDeployment()`. - * @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/mirroring.update_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeployment_async - */ - async checkUpdateMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringDeployment()`. + * @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/mirroring.update_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_UpdateMirroringDeployment_async + */ + async checkUpdateMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.MirroringDeployment, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a deployment. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/mirroring.delete_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeployment_async - */ + /** + * Deletes a deployment. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/mirroring.delete_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeployment_async + */ deleteMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeployment( - request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringDeployment request %j', request); - return this.innerApiCalls.deleteMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringDeployment()`. - * @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/mirroring.delete_mirroring_deployment.js - * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeployment_async - */ - async checkDeleteMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringDeployment()`. + * @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/mirroring.delete_mirroring_deployment.js + * region_tag:networksecurity_v1_generated_Mirroring_DeleteMirroringDeployment_async + */ + async checkDeleteMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists endpoint groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. - * 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 `listMirroringEndpointGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists endpoint groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. + * 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 `listMirroringEndpointGroupsAsync()` + * 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. + */ listMirroringEndpointGroups( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse, + ] + >; listMirroringEndpointGroups( - request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup + >, + ): void; listMirroringEndpointGroups( - request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup + >, + ): void; listMirroringEndpointGroups( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringEndpointGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2450,468 +3796,540 @@ export class MirroringClient { this._log.info('listMirroringEndpointGroups request %j', request); return this.innerApiCalls .listMirroringEndpointGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse - ]) => { - this._log.info('listMirroringEndpointGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsResponse, + ]) => { + this._log.info('listMirroringEndpointGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringEndpointGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup} 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 `listMirroringEndpointGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringEndpointGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup} 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 `listMirroringEndpointGroupsAsync()` + * 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. + */ listMirroringEndpointGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroups stream %j', request); return this.descriptors.page.listMirroringEndpointGroups.createStream( this.innerApiCalls.listMirroringEndpointGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringEndpointGroups`, 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, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. 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/mirroring.list_mirroring_endpoint_groups.js - * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringEndpointGroups_async - */ + /** + * Equivalent to `listMirroringEndpointGroups`, 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, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroup|MirroringEndpointGroup}. 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/mirroring.list_mirroring_endpoint_groups.js + * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringEndpointGroups_async + */ listMirroringEndpointGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroups iterate %j', request); return this.descriptors.page.listMirroringEndpointGroups.asyncIterate( this.innerApiCalls['listMirroringEndpointGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists associations in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. - * 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 `listMirroringEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Lists associations in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. + * 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 `listMirroringEndpointGroupAssociationsAsync()` + * 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. + */ listMirroringEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse, + ] + >; listMirroringEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation + >, + ): void; listMirroringEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation + >, + ): void; listMirroringEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMirroringEndpointGroupAssociations values %j', values); + this._log.info( + 'listMirroringEndpointGroupAssociations values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listMirroringEndpointGroupAssociations request %j', request); + this._log.info( + 'listMirroringEndpointGroupAssociations request %j', + request, + ); return this.innerApiCalls .listMirroringEndpointGroupAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse - ]) => { - this._log.info('listMirroringEndpointGroupAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsResponse, + ]) => { + this._log.info( + 'listMirroringEndpointGroupAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringEndpointGroupAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation} 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 `listMirroringEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringEndpointGroupAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation} 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 `listMirroringEndpointGroupAssociationsAsync()` + * 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. + */ listMirroringEndpointGroupAssociationsStream( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + 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['listMirroringEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listMirroringEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroupAssociations stream %j', request); return this.descriptors.page.listMirroringEndpointGroupAssociations.createStream( this.innerApiCalls.listMirroringEndpointGroupAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringEndpointGroupAssociations`, 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, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. 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/mirroring.list_mirroring_endpoint_group_associations.js - * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringEndpointGroupAssociations_async - */ + /** + * Equivalent to `listMirroringEndpointGroupAssociations`, 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, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. 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/mirroring.list_mirroring_endpoint_group_associations.js + * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringEndpointGroupAssociations_async + */ listMirroringEndpointGroupAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringEndpointGroupAssociationsRequest, + 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['listMirroringEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listMirroringEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMirroringEndpointGroupAssociations iterate %j', request); + this.initialize().catch((err) => { + throw err; + }); + this._log.info( + 'listMirroringEndpointGroupAssociations iterate %j', + request, + ); return this.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate( this.innerApiCalls['listMirroringEndpointGroupAssociations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployment groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. - * 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 `listMirroringDeploymentGroupsAsync()` - * 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. - */ + /** + * Lists deployment groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. + * 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 `listMirroringDeploymentGroupsAsync()` + * 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. + */ listMirroringDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse, + ] + >; listMirroringDeploymentGroups( - request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup + >, + ): void; listMirroringDeploymentGroups( - request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup + >, + ): void; listMirroringDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringDeploymentGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2920,232 +4338,261 @@ export class MirroringClient { this._log.info('listMirroringDeploymentGroups request %j', request); return this.innerApiCalls .listMirroringDeploymentGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse - ]) => { - this._log.info('listMirroringDeploymentGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsResponse, + ]) => { + this._log.info('listMirroringDeploymentGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringDeploymentGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup} 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 `listMirroringDeploymentGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringDeploymentGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup} 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 `listMirroringDeploymentGroupsAsync()` + * 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. + */ listMirroringDeploymentGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeploymentGroups stream %j', request); return this.descriptors.page.listMirroringDeploymentGroups.createStream( this.innerApiCalls.listMirroringDeploymentGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringDeploymentGroups`, 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, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. 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/mirroring.list_mirroring_deployment_groups.js - * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringDeploymentGroups_async - */ + /** + * Equivalent to `listMirroringDeploymentGroups`, 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, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeploymentGroup|MirroringDeploymentGroup}. 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/mirroring.list_mirroring_deployment_groups.js + * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringDeploymentGroups_async + */ listMirroringDeploymentGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeploymentGroups iterate %j', request); return this.descriptors.page.listMirroringDeploymentGroups.asyncIterate( this.innerApiCalls['listMirroringDeploymentGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployments in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. - * 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 `listMirroringDeploymentsAsync()` - * 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. - */ + /** + * Lists deployments in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. + * 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 `listMirroringDeploymentsAsync()` + * 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. + */ listMirroringDeployments( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse, + ] + >; listMirroringDeployments( - request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeployment>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeployment + >, + ): void; listMirroringDeployments( - request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeployment>): void; + request: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeployment + >, + ): void; listMirroringDeployments( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeployment>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeployment>): - Promise<[ - protos.google.cloud.networksecurity.v1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeployment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeployment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IMirroringDeployment>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IMirroringDeployment + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringDeployments values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3154,161 +4601,165 @@ export class MirroringClient { this._log.info('listMirroringDeployments request %j', request); return this.innerApiCalls .listMirroringDeployments(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse - ]) => { - this._log.info('listMirroringDeployments values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsResponse, + ]) => { + this._log.info('listMirroringDeployments values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringDeployments`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment} 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 `listMirroringDeploymentsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringDeployments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment} 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 `listMirroringDeploymentsAsync()` + * 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. + */ listMirroringDeploymentsStream( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeployments stream %j', request); return this.descriptors.page.listMirroringDeployments.createStream( this.innerApiCalls.listMirroringDeployments as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringDeployments`, 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, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. 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/mirroring.list_mirroring_deployments.js - * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringDeployments_async - */ + /** + * Equivalent to `listMirroringDeployments`, 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, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1.MirroringDeployment|MirroringDeployment}. 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/mirroring.list_mirroring_deployments.js + * region_tag:networksecurity_v1_generated_Mirroring_ListMirroringDeployments_async + */ listMirroringDeploymentsAsync( - request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListMirroringDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeployments iterate %j', request); return this.descriptors.page.listMirroringDeployments.asyncIterate( this.innerApiCalls['listMirroringDeployments'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -3322,40 +4773,40 @@ export class MirroringClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -3369,41 +4820,41 @@ export class MirroringClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -3417,12 +4868,12 @@ export class MirroringClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3457,12 +4908,11 @@ export class MirroringClient { | 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. @@ -3495,12 +4945,12 @@ export class MirroringClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -3543,22 +4993,22 @@ export class MirroringClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3593,15 +5043,15 @@ export class MirroringClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3635,7 +5085,7 @@ export class MirroringClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3648,25 +5098,24 @@ export class MirroringClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -3705,22 +5154,22 @@ export class MirroringClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -3736,7 +5185,11 @@ export class MirroringClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -3752,7 +5205,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -3763,7 +5218,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -3773,8 +5230,12 @@ export class MirroringClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -3785,7 +5246,7 @@ export class MirroringClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -3801,7 +5262,8 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -3812,7 +5274,8 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -3823,7 +5286,8 @@ export class MirroringClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -3834,7 +5298,11 @@ export class MirroringClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -3849,8 +5317,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -3860,8 +5332,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -3871,8 +5347,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -3883,7 +5363,11 @@ export class MirroringClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3899,7 +5383,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -3910,7 +5396,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -3921,7 +5409,9 @@ export class MirroringClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -3932,7 +5422,11 @@ export class MirroringClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -3948,7 +5442,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -3959,7 +5455,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -3969,8 +5467,12 @@ export class MirroringClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -3981,7 +5483,11 @@ export class MirroringClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -3996,8 +5502,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -4007,8 +5517,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -4018,8 +5532,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -4029,7 +5547,7 @@ export class MirroringClient { * @param {string} forwarding_rule * @returns {string} Resource name string. */ - forwardingRulePath(project:string,forwardingRule:string) { + forwardingRulePath(project: string, forwardingRule: string) { return this.pathTemplates.forwardingRulePathTemplate.render({ project: project, forwarding_rule: forwardingRule, @@ -4044,7 +5562,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).project; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).project; } /** @@ -4055,7 +5575,9 @@ export class MirroringClient { * @returns {string} A string representing the forwarding_rule. */ matchForwardingRuleFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).forwarding_rule; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).forwarding_rule; } /** @@ -4066,7 +5588,11 @@ export class MirroringClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -4082,7 +5608,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -4092,8 +5620,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -4103,8 +5635,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -4116,7 +5652,12 @@ export class MirroringClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -4132,8 +5673,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -4143,8 +5688,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -4154,8 +5703,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -4165,8 +5718,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -4177,7 +5734,11 @@ export class MirroringClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -4193,7 +5754,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -4204,7 +5767,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -4214,8 +5779,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -4226,7 +5795,11 @@ export class MirroringClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4241,8 +5814,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -4252,8 +5829,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -4263,8 +5844,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -4275,7 +5860,11 @@ export class MirroringClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4290,8 +5879,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -4301,8 +5894,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -4312,8 +5909,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -4324,12 +5925,18 @@ export class MirroringClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -4339,8 +5946,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -4350,8 +5961,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -4361,8 +5976,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -4372,7 +5991,7 @@ export class MirroringClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4409,7 +6028,11 @@ export class MirroringClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -4425,7 +6048,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -4436,7 +6061,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -4446,8 +6073,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -4458,7 +6089,11 @@ export class MirroringClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4473,8 +6108,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -4484,8 +6123,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -4495,8 +6138,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -4507,7 +6154,11 @@ export class MirroringClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4522,8 +6173,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -4533,8 +6188,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -4544,8 +6203,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -4556,12 +6219,18 @@ export class MirroringClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -4571,8 +6240,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -4582,8 +6255,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -4593,8 +6270,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -4604,7 +6285,7 @@ export class MirroringClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -4641,12 +6322,18 @@ export class MirroringClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -4656,8 +6343,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -4667,8 +6358,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -4678,8 +6373,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -4690,12 +6389,18 @@ export class MirroringClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4705,8 +6410,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -4716,8 +6425,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -4727,8 +6440,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4739,12 +6456,18 @@ export class MirroringClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4754,8 +6477,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -4765,8 +6492,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -4776,8 +6507,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -4788,12 +6523,18 @@ export class MirroringClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -4803,8 +6544,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -4814,8 +6559,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -4825,8 +6574,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -4835,7 +6588,7 @@ export class MirroringClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -4860,7 +6613,11 @@ export class MirroringClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -4875,8 +6632,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -4886,8 +6647,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -4897,8 +6662,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -4909,12 +6678,18 @@ export class MirroringClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4924,8 +6699,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -4935,8 +6714,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -4946,8 +6729,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4958,12 +6745,18 @@ export class MirroringClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4973,8 +6766,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -4984,8 +6781,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -4995,8 +6796,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -5007,12 +6812,18 @@ export class MirroringClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -5022,8 +6833,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -5033,8 +6848,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -5044,8 +6863,114 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -5056,7 +6981,11 @@ export class MirroringClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -5072,7 +7001,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -5083,7 +7014,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -5094,7 +7027,9 @@ export class MirroringClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -5105,7 +7040,11 @@ export class MirroringClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -5121,7 +7060,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -5132,7 +7073,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -5142,8 +7085,12 @@ export class MirroringClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -5154,7 +7101,7 @@ export class MirroringClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -5203,15 +7150,19 @@ export class MirroringClient { */ close(): Promise { if (this.mirroringStub && !this._terminated) { - return this.mirroringStub.then(stub => { + return this.mirroringStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/mirroring_proto_list.json b/packages/google-cloud-networksecurity/src/v1/mirroring_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/mirroring_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/mirroring_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/network_security_client.ts b/packages/google-cloud-networksecurity/src/v1/network_security_client.ts index b24c763e3615..92d0823cc58a 100644 --- a/packages/google-cloud-networksecurity/src/v1/network_security_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/network_security_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +59,7 @@ export class NetworkSecurityClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -59,12 +72,12 @@ export class NetworkSecurityClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - networkSecurityStub?: Promise<{[name: string]: Function}>; + networkSecurityStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of NetworkSecurityClient. @@ -105,21 +118,42 @@ export class NetworkSecurityClient { * const client = new NetworkSecurityClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NetworkSecurityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -144,7 +178,7 @@ export class NetworkSecurityClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,18 +191,14 @@ export class NetworkSecurityClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -190,85 +220,100 @@ export class NetworkSecurityClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -276,24 +321,51 @@ export class NetworkSecurityClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAuthorizationPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'authorizationPolicies'), - listBackendAuthenticationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backendAuthenticationConfigs'), - listServerTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serverTlsPolicies'), - listClientTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clientTlsPolicies'), - listGatewaySecurityPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gatewaySecurityPolicies'), - listGatewaySecurityPolicyRules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gatewaySecurityPolicyRules'), - listUrlLists: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'urlLists'), - listTlsInspectionPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tlsInspectionPolicies'), - listAuthzPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'authzPolicies') + listAuthorizationPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'authorizationPolicies', + ), + listBackendAuthenticationConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backendAuthenticationConfigs', + ), + listServerTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'serverTlsPolicies', + ), + listClientTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'clientTlsPolicies', + ), + listGatewaySecurityPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'gatewaySecurityPolicies', + ), + listGatewaySecurityPolicyRules: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'gatewaySecurityPolicyRules', + ), + listUrlLists: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'urlLists', + ), + listTlsInspectionPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'tlsInspectionPolicies', + ), + listAuthzPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'authzPolicies', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -302,246 +374,528 @@ export class NetworkSecurityClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AuthorizationPolicy', + ) as gax.protobuf.Type; const createAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AuthorizationPolicy', + ) as gax.protobuf.Type; const updateAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.BackendAuthenticationConfig') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.BackendAuthenticationConfig', + ) as gax.protobuf.Type; const createBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.BackendAuthenticationConfig') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.BackendAuthenticationConfig', + ) as gax.protobuf.Type; const updateBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.ServerTlsPolicy', + ) as gax.protobuf.Type; const createServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.ServerTlsPolicy', + ) as gax.protobuf.Type; const updateServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.ClientTlsPolicy', + ) as gax.protobuf.Type; const createClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.ClientTlsPolicy', + ) as gax.protobuf.Type; const updateClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.GatewaySecurityPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.GatewaySecurityPolicy', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.GatewaySecurityPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.GatewaySecurityPolicy', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createUrlListResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.UrlList') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.UrlList', + ) as gax.protobuf.Type; const createUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateUrlListResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.UrlList') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.UrlList', + ) as gax.protobuf.Type; const updateUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteUrlListResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.TlsInspectionPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.TlsInspectionPolicy', + ) as gax.protobuf.Type; const createTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.TlsInspectionPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.TlsInspectionPolicy', + ) as gax.protobuf.Type; const updateTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AuthzPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AuthzPolicy', + ) as gax.protobuf.Type; const createAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AuthzPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AuthzPolicy', + ) as gax.protobuf.Type; const updateAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createAuthorizationPolicyResponse.decode.bind(createAuthorizationPolicyResponse), - createAuthorizationPolicyMetadata.decode.bind(createAuthorizationPolicyMetadata)), + createAuthorizationPolicyResponse.decode.bind( + createAuthorizationPolicyResponse, + ), + createAuthorizationPolicyMetadata.decode.bind( + createAuthorizationPolicyMetadata, + ), + ), updateAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateAuthorizationPolicyResponse.decode.bind(updateAuthorizationPolicyResponse), - updateAuthorizationPolicyMetadata.decode.bind(updateAuthorizationPolicyMetadata)), + updateAuthorizationPolicyResponse.decode.bind( + updateAuthorizationPolicyResponse, + ), + updateAuthorizationPolicyMetadata.decode.bind( + updateAuthorizationPolicyMetadata, + ), + ), deleteAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteAuthorizationPolicyResponse.decode.bind(deleteAuthorizationPolicyResponse), - deleteAuthorizationPolicyMetadata.decode.bind(deleteAuthorizationPolicyMetadata)), - createBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackendAuthenticationConfigResponse.decode.bind(createBackendAuthenticationConfigResponse), - createBackendAuthenticationConfigMetadata.decode.bind(createBackendAuthenticationConfigMetadata)), - updateBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackendAuthenticationConfigResponse.decode.bind(updateBackendAuthenticationConfigResponse), - updateBackendAuthenticationConfigMetadata.decode.bind(updateBackendAuthenticationConfigMetadata)), - deleteBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackendAuthenticationConfigResponse.decode.bind(deleteBackendAuthenticationConfigResponse), - deleteBackendAuthenticationConfigMetadata.decode.bind(deleteBackendAuthenticationConfigMetadata)), + deleteAuthorizationPolicyResponse.decode.bind( + deleteAuthorizationPolicyResponse, + ), + deleteAuthorizationPolicyMetadata.decode.bind( + deleteAuthorizationPolicyMetadata, + ), + ), + createBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackendAuthenticationConfigResponse.decode.bind( + createBackendAuthenticationConfigResponse, + ), + createBackendAuthenticationConfigMetadata.decode.bind( + createBackendAuthenticationConfigMetadata, + ), + ), + updateBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackendAuthenticationConfigResponse.decode.bind( + updateBackendAuthenticationConfigResponse, + ), + updateBackendAuthenticationConfigMetadata.decode.bind( + updateBackendAuthenticationConfigMetadata, + ), + ), + deleteBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackendAuthenticationConfigResponse.decode.bind( + deleteBackendAuthenticationConfigResponse, + ), + deleteBackendAuthenticationConfigMetadata.decode.bind( + deleteBackendAuthenticationConfigMetadata, + ), + ), createServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createServerTlsPolicyResponse.decode.bind(createServerTlsPolicyResponse), - createServerTlsPolicyMetadata.decode.bind(createServerTlsPolicyMetadata)), + createServerTlsPolicyResponse.decode.bind( + createServerTlsPolicyResponse, + ), + createServerTlsPolicyMetadata.decode.bind( + createServerTlsPolicyMetadata, + ), + ), updateServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateServerTlsPolicyResponse.decode.bind(updateServerTlsPolicyResponse), - updateServerTlsPolicyMetadata.decode.bind(updateServerTlsPolicyMetadata)), + updateServerTlsPolicyResponse.decode.bind( + updateServerTlsPolicyResponse, + ), + updateServerTlsPolicyMetadata.decode.bind( + updateServerTlsPolicyMetadata, + ), + ), deleteServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteServerTlsPolicyResponse.decode.bind(deleteServerTlsPolicyResponse), - deleteServerTlsPolicyMetadata.decode.bind(deleteServerTlsPolicyMetadata)), + deleteServerTlsPolicyResponse.decode.bind( + deleteServerTlsPolicyResponse, + ), + deleteServerTlsPolicyMetadata.decode.bind( + deleteServerTlsPolicyMetadata, + ), + ), createClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createClientTlsPolicyResponse.decode.bind(createClientTlsPolicyResponse), - createClientTlsPolicyMetadata.decode.bind(createClientTlsPolicyMetadata)), + createClientTlsPolicyResponse.decode.bind( + createClientTlsPolicyResponse, + ), + createClientTlsPolicyMetadata.decode.bind( + createClientTlsPolicyMetadata, + ), + ), updateClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateClientTlsPolicyResponse.decode.bind(updateClientTlsPolicyResponse), - updateClientTlsPolicyMetadata.decode.bind(updateClientTlsPolicyMetadata)), + updateClientTlsPolicyResponse.decode.bind( + updateClientTlsPolicyResponse, + ), + updateClientTlsPolicyMetadata.decode.bind( + updateClientTlsPolicyMetadata, + ), + ), deleteClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteClientTlsPolicyResponse.decode.bind(deleteClientTlsPolicyResponse), - deleteClientTlsPolicyMetadata.decode.bind(deleteClientTlsPolicyMetadata)), + deleteClientTlsPolicyResponse.decode.bind( + deleteClientTlsPolicyResponse, + ), + deleteClientTlsPolicyMetadata.decode.bind( + deleteClientTlsPolicyMetadata, + ), + ), createGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createGatewaySecurityPolicyResponse.decode.bind(createGatewaySecurityPolicyResponse), - createGatewaySecurityPolicyMetadata.decode.bind(createGatewaySecurityPolicyMetadata)), + createGatewaySecurityPolicyResponse.decode.bind( + createGatewaySecurityPolicyResponse, + ), + createGatewaySecurityPolicyMetadata.decode.bind( + createGatewaySecurityPolicyMetadata, + ), + ), updateGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateGatewaySecurityPolicyResponse.decode.bind(updateGatewaySecurityPolicyResponse), - updateGatewaySecurityPolicyMetadata.decode.bind(updateGatewaySecurityPolicyMetadata)), + updateGatewaySecurityPolicyResponse.decode.bind( + updateGatewaySecurityPolicyResponse, + ), + updateGatewaySecurityPolicyMetadata.decode.bind( + updateGatewaySecurityPolicyMetadata, + ), + ), deleteGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteGatewaySecurityPolicyResponse.decode.bind(deleteGatewaySecurityPolicyResponse), - deleteGatewaySecurityPolicyMetadata.decode.bind(deleteGatewaySecurityPolicyMetadata)), - createGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGatewaySecurityPolicyRuleResponse.decode.bind(createGatewaySecurityPolicyRuleResponse), - createGatewaySecurityPolicyRuleMetadata.decode.bind(createGatewaySecurityPolicyRuleMetadata)), - updateGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateGatewaySecurityPolicyRuleResponse.decode.bind(updateGatewaySecurityPolicyRuleResponse), - updateGatewaySecurityPolicyRuleMetadata.decode.bind(updateGatewaySecurityPolicyRuleMetadata)), - deleteGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGatewaySecurityPolicyRuleResponse.decode.bind(deleteGatewaySecurityPolicyRuleResponse), - deleteGatewaySecurityPolicyRuleMetadata.decode.bind(deleteGatewaySecurityPolicyRuleMetadata)), + deleteGatewaySecurityPolicyResponse.decode.bind( + deleteGatewaySecurityPolicyResponse, + ), + deleteGatewaySecurityPolicyMetadata.decode.bind( + deleteGatewaySecurityPolicyMetadata, + ), + ), + createGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGatewaySecurityPolicyRuleResponse.decode.bind( + createGatewaySecurityPolicyRuleResponse, + ), + createGatewaySecurityPolicyRuleMetadata.decode.bind( + createGatewaySecurityPolicyRuleMetadata, + ), + ), + updateGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateGatewaySecurityPolicyRuleResponse.decode.bind( + updateGatewaySecurityPolicyRuleResponse, + ), + updateGatewaySecurityPolicyRuleMetadata.decode.bind( + updateGatewaySecurityPolicyRuleMetadata, + ), + ), + deleteGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGatewaySecurityPolicyRuleResponse.decode.bind( + deleteGatewaySecurityPolicyRuleResponse, + ), + deleteGatewaySecurityPolicyRuleMetadata.decode.bind( + deleteGatewaySecurityPolicyRuleMetadata, + ), + ), createUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createUrlListResponse.decode.bind(createUrlListResponse), - createUrlListMetadata.decode.bind(createUrlListMetadata)), + createUrlListMetadata.decode.bind(createUrlListMetadata), + ), updateUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateUrlListResponse.decode.bind(updateUrlListResponse), - updateUrlListMetadata.decode.bind(updateUrlListMetadata)), + updateUrlListMetadata.decode.bind(updateUrlListMetadata), + ), deleteUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteUrlListResponse.decode.bind(deleteUrlListResponse), - deleteUrlListMetadata.decode.bind(deleteUrlListMetadata)), + deleteUrlListMetadata.decode.bind(deleteUrlListMetadata), + ), createTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createTlsInspectionPolicyResponse.decode.bind(createTlsInspectionPolicyResponse), - createTlsInspectionPolicyMetadata.decode.bind(createTlsInspectionPolicyMetadata)), + createTlsInspectionPolicyResponse.decode.bind( + createTlsInspectionPolicyResponse, + ), + createTlsInspectionPolicyMetadata.decode.bind( + createTlsInspectionPolicyMetadata, + ), + ), updateTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateTlsInspectionPolicyResponse.decode.bind(updateTlsInspectionPolicyResponse), - updateTlsInspectionPolicyMetadata.decode.bind(updateTlsInspectionPolicyMetadata)), + updateTlsInspectionPolicyResponse.decode.bind( + updateTlsInspectionPolicyResponse, + ), + updateTlsInspectionPolicyMetadata.decode.bind( + updateTlsInspectionPolicyMetadata, + ), + ), deleteTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteTlsInspectionPolicyResponse.decode.bind(deleteTlsInspectionPolicyResponse), - deleteTlsInspectionPolicyMetadata.decode.bind(deleteTlsInspectionPolicyMetadata)), + deleteTlsInspectionPolicyResponse.decode.bind( + deleteTlsInspectionPolicyResponse, + ), + deleteTlsInspectionPolicyMetadata.decode.bind( + deleteTlsInspectionPolicyMetadata, + ), + ), createAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createAuthzPolicyResponse.decode.bind(createAuthzPolicyResponse), - createAuthzPolicyMetadata.decode.bind(createAuthzPolicyMetadata)), + createAuthzPolicyMetadata.decode.bind(createAuthzPolicyMetadata), + ), updateAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAuthzPolicyResponse.decode.bind(updateAuthzPolicyResponse), - updateAuthzPolicyMetadata.decode.bind(updateAuthzPolicyMetadata)), + updateAuthzPolicyMetadata.decode.bind(updateAuthzPolicyMetadata), + ), deleteAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAuthzPolicyResponse.decode.bind(deleteAuthzPolicyResponse), - deleteAuthzPolicyMetadata.decode.bind(deleteAuthzPolicyMetadata)) + deleteAuthzPolicyMetadata.decode.bind(deleteAuthzPolicyMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.NetworkSecurity', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.NetworkSecurity', + 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 @@ -572,28 +926,79 @@ export class NetworkSecurityClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.NetworkSecurity. this.networkSecurityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.NetworkSecurity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.NetworkSecurity', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.networksecurity.v1.NetworkSecurity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 networkSecurityStubMethods = - ['listAuthorizationPolicies', 'getAuthorizationPolicy', 'createAuthorizationPolicy', 'updateAuthorizationPolicy', 'deleteAuthorizationPolicy', 'listBackendAuthenticationConfigs', 'getBackendAuthenticationConfig', 'createBackendAuthenticationConfig', 'updateBackendAuthenticationConfig', 'deleteBackendAuthenticationConfig', 'listServerTlsPolicies', 'getServerTlsPolicy', 'createServerTlsPolicy', 'updateServerTlsPolicy', 'deleteServerTlsPolicy', 'listClientTlsPolicies', 'getClientTlsPolicy', 'createClientTlsPolicy', 'updateClientTlsPolicy', 'deleteClientTlsPolicy', 'listGatewaySecurityPolicies', 'getGatewaySecurityPolicy', 'createGatewaySecurityPolicy', 'updateGatewaySecurityPolicy', 'deleteGatewaySecurityPolicy', 'listGatewaySecurityPolicyRules', 'getGatewaySecurityPolicyRule', 'createGatewaySecurityPolicyRule', 'updateGatewaySecurityPolicyRule', 'deleteGatewaySecurityPolicyRule', 'listUrlLists', 'getUrlList', 'createUrlList', 'updateUrlList', 'deleteUrlList', 'listTlsInspectionPolicies', 'getTlsInspectionPolicy', 'createTlsInspectionPolicy', 'updateTlsInspectionPolicy', 'deleteTlsInspectionPolicy', 'listAuthzPolicies', 'getAuthzPolicy', 'createAuthzPolicy', 'updateAuthzPolicy', 'deleteAuthzPolicy']; + const networkSecurityStubMethods = [ + 'listAuthorizationPolicies', + 'getAuthorizationPolicy', + 'createAuthorizationPolicy', + 'updateAuthorizationPolicy', + 'deleteAuthorizationPolicy', + 'listBackendAuthenticationConfigs', + 'getBackendAuthenticationConfig', + 'createBackendAuthenticationConfig', + 'updateBackendAuthenticationConfig', + 'deleteBackendAuthenticationConfig', + 'listServerTlsPolicies', + 'getServerTlsPolicy', + 'createServerTlsPolicy', + 'updateServerTlsPolicy', + 'deleteServerTlsPolicy', + 'listClientTlsPolicies', + 'getClientTlsPolicy', + 'createClientTlsPolicy', + 'updateClientTlsPolicy', + 'deleteClientTlsPolicy', + 'listGatewaySecurityPolicies', + 'getGatewaySecurityPolicy', + 'createGatewaySecurityPolicy', + 'updateGatewaySecurityPolicy', + 'deleteGatewaySecurityPolicy', + 'listGatewaySecurityPolicyRules', + 'getGatewaySecurityPolicyRule', + 'createGatewaySecurityPolicyRule', + 'updateGatewaySecurityPolicyRule', + 'deleteGatewaySecurityPolicyRule', + 'listUrlLists', + 'getUrlList', + 'createUrlList', + 'updateUrlList', + 'deleteUrlList', + 'listTlsInspectionPolicies', + 'getTlsInspectionPolicy', + 'createTlsInspectionPolicy', + 'updateTlsInspectionPolicy', + 'deleteTlsInspectionPolicy', + 'listAuthzPolicies', + 'getAuthzPolicy', + 'createAuthzPolicy', + 'updateAuthzPolicy', + 'deleteAuthzPolicy', + ]; for (const methodName of networkSecurityStubMethods) { const callPromise = this.networkSecurityStub.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) => () => { + (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] || @@ -603,7 +1008,7 @@ export class NetworkSecurityClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -618,8 +1023,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -630,8 +1041,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -662,9 +1079,7 @@ export class NetworkSecurityClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -673,8 +1088,9 @@ export class NetworkSecurityClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -685,4031 +1101,6219 @@ export class NetworkSecurityClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. - * 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/network_security.get_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetAuthorizationPolicy_async - */ + /** + * Gets details of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. + * 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/network_security.get_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetAuthorizationPolicy_async + */ getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAuthorizationPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAuthorizationPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAuthorizationPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAuthorizationPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the BackendAuthenticationConfig to get. Must be in the - * format `projects/* /locations/{location}/backendAuthenticationConfigs/*`. - * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. - * 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/network_security.get_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetBackendAuthenticationConfig_async - */ + /** + * Gets details of a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the BackendAuthenticationConfig to get. Must be in the + * format `projects/* /locations/{location}/backendAuthenticationConfigs/*`. + * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. + * 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/network_security.get_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetBackendAuthenticationConfig_async + */ getBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ] + >; getBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getBackendAuthenticationConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getBackendAuthenticationConfig response %j', response); + this._log.info( + 'getBackendAuthenticationConfig response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBackendAuthenticationConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getBackendAuthenticationConfig response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. - * 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/network_security.get_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetServerTlsPolicy_async - */ + /** + * Gets details of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. + * 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/network_security.get_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetServerTlsPolicy_async + */ getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getServerTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getServerTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServerTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getServerTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. - * 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/network_security.get_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetClientTlsPolicy_async - */ + /** + * Gets details of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. + * 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/network_security.get_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetClientTlsPolicy_async + */ getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getClientTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getClientTlsPolicy response %j', response); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getClientTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getClientTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getClientTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. - * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. - * 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/network_security.get_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetGatewaySecurityPolicy_async - */ + /** + * Gets details of a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. + * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. + * 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/network_security.get_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetGatewaySecurityPolicy_async + */ getGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGatewaySecurityPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGatewaySecurityPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGatewaySecurityPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getGatewaySecurityPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the GatewaySecurityPolicyRule to retrieve. - * Format: - * projects/{project}/location/{location}/gatewaySecurityPolicies/* /rules/* - * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. - * 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/network_security.get_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetGatewaySecurityPolicyRule_async - */ + /** + * Gets details of a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the GatewaySecurityPolicyRule to retrieve. + * Format: + * projects/{project}/location/{location}/gatewaySecurityPolicies/* /rules/* + * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. + * 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/network_security.get_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetGatewaySecurityPolicyRule_async + */ getGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ] + >; getGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGatewaySecurityPolicyRule request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGatewaySecurityPolicyRule response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGatewaySecurityPolicyRule response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getGatewaySecurityPolicyRule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the UrlList to get. Must be in the format - * `projects/* /locations/{location}/urlLists/*`. - * @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.networksecurity.v1.UrlList|UrlList}. - * 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/network_security.get_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetUrlList_async - */ + /** + * Gets details of a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the UrlList to get. Must be in the format + * `projects/* /locations/{location}/urlLists/*`. + * @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.networksecurity.v1.UrlList|UrlList}. + * 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/network_security.get_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetUrlList_async + */ getUrlList( - request?: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IGetUrlListRequest | undefined, + {} | undefined, + ] + >; getUrlList( - request: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IUrlList, + | protos.google.cloud.networksecurity.v1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUrlList( - request: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IUrlList, + | protos.google.cloud.networksecurity.v1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUrlList( - request?: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IUrlList, + | protos.google.cloud.networksecurity.v1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IGetUrlListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getUrlList request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IUrlList, + | protos.google.cloud.networksecurity.v1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getUrlList response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getUrlList(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IUrlList, - protos.google.cloud.networksecurity.v1.IGetUrlListRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUrlList response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getUrlList(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IGetUrlListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getUrlList response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the TlsInspectionPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. - * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. - * 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/network_security.get_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetTlsInspectionPolicy_async - */ + /** + * Gets details of a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the TlsInspectionPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. + * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. + * 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/network_security.get_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetTlsInspectionPolicy_async + */ getTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getTlsInspectionPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getTlsInspectionPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getTlsInspectionPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getTlsInspectionPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the `AuthzPolicy` resource to get. Must be in the - * format - * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. - * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. - * 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/network_security.get_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_GetAuthzPolicy_async - */ + /** + * Gets details of a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the `AuthzPolicy` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. + * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. + * 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/network_security.get_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_GetAuthzPolicy_async + */ getAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest | undefined, + {} | undefined, + ] + >; getAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAuthzPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAuthzPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAuthzPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + ( + | protos.google.cloud.networksecurity.v1.IGetAuthzPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAuthzPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new AuthorizationPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the AuthorizationPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.authorizationPolicyId - * Required. Short name of the AuthorizationPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "authz_policy". - * @param {google.cloud.networksecurity.v1.AuthorizationPolicy} request.authorizationPolicy - * Required. AuthorizationPolicy resource to be created. - * @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/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ + /** + * Creates a new AuthorizationPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the AuthorizationPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.authorizationPolicyId + * Required. Short name of the AuthorizationPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "authz_policy". + * @param {google.cloud.networksecurity.v1.AuthorizationPolicy} request.authorizationPolicy + * Required. AuthorizationPolicy resource to be created. + * @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/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAuthorizationPolicy request %j', request); - return this.innerApiCalls.createAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAuthorizationPolicy()`. - * @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/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ - async checkCreateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAuthorizationPolicy()`. + * @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/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ + async checkCreateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * AuthorizationPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.AuthorizationPolicy} request.authorizationPolicy - * Required. Updated AuthorizationPolicy 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/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ + /** + * Updates the parameters of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * AuthorizationPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.AuthorizationPolicy} request.authorizationPolicy + * Required. Updated AuthorizationPolicy 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/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAuthorizationPolicy request %j', request); - return this.innerApiCalls.updateAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. - * @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/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ - async checkUpdateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. + * @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/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ + async checkUpdateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to delete. Must be in the - * format `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ + /** + * Deletes a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to delete. Must be in the + * format `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAuthorizationPolicy request %j', request); - return this.innerApiCalls.deleteAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. - * @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/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ - async checkDeleteAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. + * @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/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ + async checkDeleteAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new BackendAuthenticationConfig in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the BackendAuthenticationConfig. Must be - * in the format `projects/* /locations/{location}`. - * @param {string} request.backendAuthenticationConfigId - * Required. Short name of the BackendAuthenticationConfig resource to be - * created. This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start with a - * number. E.g. "backend-auth-config". - * @param {google.cloud.networksecurity.v1.BackendAuthenticationConfig} request.backendAuthenticationConfig - * Required. BackendAuthenticationConfig resource to be created. - * @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/network_security.create_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async - */ + /** + * Creates a new BackendAuthenticationConfig in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the BackendAuthenticationConfig. Must be + * in the format `projects/* /locations/{location}`. + * @param {string} request.backendAuthenticationConfigId + * Required. Short name of the BackendAuthenticationConfig resource to be + * created. This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start with a + * number. E.g. "backend-auth-config". + * @param {google.cloud.networksecurity.v1.BackendAuthenticationConfig} request.backendAuthenticationConfig + * Required. BackendAuthenticationConfig resource to be created. + * @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/network_security.create_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async + */ createBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'createBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.createBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createBackendAuthenticationConfig()`. - * @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/network_security.create_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async - */ - async checkCreateBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createBackendAuthenticationConfig()`. + * @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/network_security.create_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async + */ + async checkCreateBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * BackendAuthenticationConfig resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1.BackendAuthenticationConfig} request.backendAuthenticationConfig - * Required. Updated BackendAuthenticationConfig 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/network_security.update_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async - */ + /** + * Updates the parameters of a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * BackendAuthenticationConfig resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1.BackendAuthenticationConfig} request.backendAuthenticationConfig + * Required. Updated BackendAuthenticationConfig 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/network_security.update_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async + */ updateBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'backend_authentication_config.name': request.backendAuthenticationConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backend_authentication_config.name': + request.backendAuthenticationConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'updateBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.updateBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateBackendAuthenticationConfig()`. - * @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/network_security.update_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async - */ - async checkUpdateBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateBackendAuthenticationConfig()`. + * @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/network_security.update_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async + */ + async checkUpdateBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the BackendAuthenticationConfig to delete. Must be in - * the format - * `projects/* /locations/{location}/backendAuthenticationConfigs/*`. - * @param {string} [request.etag] - * Optional. Etag of the resource. - * If this is provided, it must match the server's etag. - * @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/network_security.delete_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async - */ + /** + * Deletes a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the BackendAuthenticationConfig to delete. Must be in + * the format + * `projects/* /locations/{location}/backendAuthenticationConfigs/*`. + * @param {string} [request.etag] + * Optional. Etag of the resource. + * If this is provided, it must match the server's etag. + * @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/network_security.delete_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async + */ deleteBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'deleteBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.deleteBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteBackendAuthenticationConfig()`. - * @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/network_security.delete_backend_authentication_config.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async - */ - async checkDeleteBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteBackendAuthenticationConfig()`. + * @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/network_security.delete_backend_authentication_config.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async + */ + async checkDeleteBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new ServerTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ServerTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.serverTlsPolicyId - * Required. Short name of the ServerTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "server_mtls_policy". - * @param {google.cloud.networksecurity.v1.ServerTlsPolicy} request.serverTlsPolicy - * Required. ServerTlsPolicy resource to be created. - * @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/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ + /** + * Creates a new ServerTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ServerTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.serverTlsPolicyId + * Required. Short name of the ServerTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "server_mtls_policy". + * @param {google.cloud.networksecurity.v1.ServerTlsPolicy} request.serverTlsPolicy + * Required. ServerTlsPolicy resource to be created. + * @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/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createServerTlsPolicy request %j', request); - return this.innerApiCalls.createServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createServerTlsPolicy()`. - * @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/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ - async checkCreateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createServerTlsPolicy()`. + * @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/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ + async checkCreateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ServerTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1.ServerTlsPolicy} request.serverTlsPolicy - * Required. Updated ServerTlsPolicy 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/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ + /** + * Updates the parameters of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ServerTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1.ServerTlsPolicy} request.serverTlsPolicy + * Required. Updated ServerTlsPolicy 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/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateServerTlsPolicy request %j', request); - return this.innerApiCalls.updateServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateServerTlsPolicy()`. - * @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/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ - async checkUpdateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateServerTlsPolicy()`. + * @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/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ + async checkUpdateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ + /** + * Deletes a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteServerTlsPolicy request %j', request); - return this.innerApiCalls.deleteServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. - * @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/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ - async checkDeleteServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. + * @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/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ + async checkDeleteServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new ClientTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ClientTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.clientTlsPolicyId - * Required. Short name of the ClientTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "client_mtls_policy". - * @param {google.cloud.networksecurity.v1.ClientTlsPolicy} request.clientTlsPolicy - * Required. ClientTlsPolicy resource to be created. - * @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/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ + /** + * Creates a new ClientTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ClientTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.clientTlsPolicyId + * Required. Short name of the ClientTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "client_mtls_policy". + * @param {google.cloud.networksecurity.v1.ClientTlsPolicy} request.clientTlsPolicy + * Required. ClientTlsPolicy resource to be created. + * @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/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createClientTlsPolicy request %j', request); - return this.innerApiCalls.createClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createClientTlsPolicy()`. - * @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/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ - async checkCreateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createClientTlsPolicy()`. + * @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/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ + async checkCreateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ClientTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1.ClientTlsPolicy} request.clientTlsPolicy - * Required. Updated ClientTlsPolicy 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/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ + /** + * Updates the parameters of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ClientTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1.ClientTlsPolicy} request.clientTlsPolicy + * Required. Updated ClientTlsPolicy 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/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateClientTlsPolicy request %j', request); - return this.innerApiCalls.updateClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateClientTlsPolicy()`. - * @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/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ - async checkUpdateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateClientTlsPolicy()`. + * @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/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ + async checkUpdateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ + /** + * Deletes a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteClientTlsPolicy request %j', request); - return this.innerApiCalls.deleteClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. - * @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/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ - async checkDeleteClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. + * @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/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ + async checkDeleteClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new GatewaySecurityPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the GatewaySecurityPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.gatewaySecurityPolicyId - * Required. Short name of the GatewaySecurityPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "gateway_security_policy1". - * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicy} request.gatewaySecurityPolicy - * Required. GatewaySecurityPolicy resource to be created. - * @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/network_security.create_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async - */ + /** + * Creates a new GatewaySecurityPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the GatewaySecurityPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.gatewaySecurityPolicyId + * Required. Short name of the GatewaySecurityPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "gateway_security_policy1". + * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicy} request.gatewaySecurityPolicy + * Required. GatewaySecurityPolicy resource to be created. + * @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/network_security.create_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async + */ createGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'createGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.createGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createGatewaySecurityPolicy()`. - * @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/network_security.create_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async - */ - async checkCreateGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createGatewaySecurityPolicy()`. + * @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/network_security.create_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async + */ + async checkCreateGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * GatewaySecurityPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicy} request.gatewaySecurityPolicy - * Required. Updated GatewaySecurityPolicy 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/network_security.update_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async - */ + /** + * Updates the parameters of a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * GatewaySecurityPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicy} request.gatewaySecurityPolicy + * Required. Updated GatewaySecurityPolicy 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/network_security.update_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async + */ updateGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'gateway_security_policy.name': request.gatewaySecurityPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'gateway_security_policy.name': + request.gatewaySecurityPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'updateGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.updateGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateGatewaySecurityPolicy()`. - * @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/network_security.update_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async - */ - async checkUpdateGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateGatewaySecurityPolicy()`. + * @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/network_security.update_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async + */ + async checkUpdateGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicy to delete. Must be in the - * format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. - * @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/network_security.delete_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async - */ + /** + * Deletes a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicy to delete. Must be in the + * format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. + * @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/network_security.delete_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async + */ deleteGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'deleteGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.deleteGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteGatewaySecurityPolicy()`. - * @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/network_security.delete_gateway_security_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async - */ - async checkDeleteGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteGatewaySecurityPolicy()`. + * @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/network_security.delete_gateway_security_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async + */ + async checkDeleteGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new GatewaySecurityPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent where this rule will be created. - * Format : - * projects/{project}/location/{location}/gatewaySecurityPolicies/* - * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule - * Required. The rule to be created. - * @param {string} request.gatewaySecurityPolicyRuleId - * The ID to use for the rule, which will become the final component of - * the rule's resource name. - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. - * @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/network_security.create_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async - */ + /** + * Creates a new GatewaySecurityPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent where this rule will be created. + * Format : + * projects/{project}/location/{location}/gatewaySecurityPolicies/* + * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule + * Required. The rule to be created. + * @param {string} request.gatewaySecurityPolicyRuleId + * The ID to use for the rule, which will become the final component of + * the rule's resource name. + * This value should be 4-63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. + * @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/network_security.create_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async + */ createGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'createGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.createGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createGatewaySecurityPolicyRule()`. - * @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/network_security.create_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async - */ - async checkCreateGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createGatewaySecurityPolicyRule()`. + * @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/network_security.create_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async + */ + async checkCreateGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * GatewaySecurityPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule - * Required. Updated GatewaySecurityPolicyRule 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/network_security.update_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async - */ + /** + * Updates the parameters of a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * GatewaySecurityPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule + * Required. Updated GatewaySecurityPolicyRule 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/network_security.update_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async + */ updateGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'gateway_security_policy_rule.name': request.gatewaySecurityPolicyRule!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'gateway_security_policy_rule.name': + request.gatewaySecurityPolicyRule!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'updateGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.updateGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateGatewaySecurityPolicyRule()`. - * @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/network_security.update_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async - */ - async checkUpdateGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateGatewaySecurityPolicyRule()`. + * @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/network_security.update_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async + */ + async checkUpdateGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicyRule to delete. Must be in the - * format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}/rules/*`. - * @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/network_security.delete_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async - */ + /** + * Deletes a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicyRule to delete. Must be in the + * format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}/rules/*`. + * @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/network_security.delete_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async + */ deleteGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'deleteGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.deleteGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteGatewaySecurityPolicyRule()`. - * @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/network_security.delete_gateway_security_policy_rule.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async - */ - async checkDeleteGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteGatewaySecurityPolicyRule()`. + * @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/network_security.delete_gateway_security_policy_rule.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async + */ + async checkDeleteGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new UrlList in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the UrlList. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.urlListId - * Required. Short name of the UrlList resource to be created. This value - * should be 1-63 characters long, containing only letters, numbers, hyphens, - * and underscores, and should not start with a number. E.g. "url_list". - * @param {google.cloud.networksecurity.v1.UrlList} request.urlList - * Required. UrlList resource to be created. - * @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/network_security.create_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateUrlList_async - */ + /** + * Creates a new UrlList in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the UrlList. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.urlListId + * Required. Short name of the UrlList resource to be created. This value + * should be 1-63 characters long, containing only letters, numbers, hyphens, + * and underscores, and should not start with a number. E.g. "url_list". + * @param {google.cloud.networksecurity.v1.UrlList} request.urlList + * Required. UrlList resource to be created. + * @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/network_security.create_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateUrlList_async + */ createUrlList( - request?: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createUrlList( - request: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUrlList( - request: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUrlList( - request?: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createUrlList request %j', request); - return this.innerApiCalls.createUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createUrlList()`. - * @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/network_security.create_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateUrlList_async - */ - async checkCreateUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createUrlList()`. + * @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/network_security.create_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateUrlList_async + */ + async checkCreateUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.UrlList, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.UrlList, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * UrlList resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1.UrlList} request.urlList - * Required. Updated UrlList 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/network_security.update_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateUrlList_async - */ + /** + * Updates the parameters of a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * UrlList resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1.UrlList} request.urlList + * Required. Updated UrlList 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/network_security.update_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateUrlList_async + */ updateUrlList( - request?: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateUrlList( - request: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateUrlList( - request: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateUrlList( - request?: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'url_list.name': request.urlList!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'url_list.name': request.urlList!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateUrlList request %j', request); - return this.innerApiCalls.updateUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateUrlList()`. - * @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/network_security.update_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateUrlList_async - */ - async checkUpdateUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateUrlList()`. + * @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/network_security.update_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateUrlList_async + */ + async checkUpdateUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.UrlList, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.UrlList, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the UrlList to delete. Must be in - * the format `projects/* /locations/{location}/urlLists/*`. - * @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/network_security.delete_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteUrlList_async - */ + /** + * Deletes a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the UrlList to delete. Must be in + * the format `projects/* /locations/{location}/urlLists/*`. + * @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/network_security.delete_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteUrlList_async + */ deleteUrlList( - request?: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteUrlList( - request: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUrlList( - request: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUrlList( - request?: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteUrlList request %j', request); - return this.innerApiCalls.deleteUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteUrlList()`. - * @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/network_security.delete_url_list.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteUrlList_async - */ - async checkDeleteUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteUrlList()`. + * @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/network_security.delete_url_list.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteUrlList_async + */ + async checkDeleteUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new TlsInspectionPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the TlsInspectionPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.tlsInspectionPolicyId - * Required. Short name of the TlsInspectionPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "tls_inspection_policy1". - * @param {google.cloud.networksecurity.v1.TlsInspectionPolicy} request.tlsInspectionPolicy - * Required. TlsInspectionPolicy resource to be created. - * @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/network_security.create_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async - */ + /** + * Creates a new TlsInspectionPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the TlsInspectionPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.tlsInspectionPolicyId + * Required. Short name of the TlsInspectionPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "tls_inspection_policy1". + * @param {google.cloud.networksecurity.v1.TlsInspectionPolicy} request.tlsInspectionPolicy + * Required. TlsInspectionPolicy resource to be created. + * @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/network_security.create_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async + */ createTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createTlsInspectionPolicy request %j', request); - return this.innerApiCalls.createTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createTlsInspectionPolicy()`. - * @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/network_security.create_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async - */ - async checkCreateTlsInspectionPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createTlsInspectionPolicy()`. + * @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/network_security.create_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async + */ + async checkCreateTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * TlsInspectionPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.TlsInspectionPolicy} request.tlsInspectionPolicy - * Required. Updated TlsInspectionPolicy 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/network_security.update_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async - */ + /** + * Updates the parameters of a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsInspectionPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.TlsInspectionPolicy} request.tlsInspectionPolicy + * Required. Updated TlsInspectionPolicy 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/network_security.update_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async + */ updateTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'tls_inspection_policy.name': request.tlsInspectionPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'tls_inspection_policy.name': request.tlsInspectionPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateTlsInspectionPolicy request %j', request); - return this.innerApiCalls.updateTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `updateTlsInspectionPolicy()`. - * @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/network_security.update_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async - */ - async checkUpdateTlsInspectionPolicyProgress(name: string): Promise>{ + return this.innerApiCalls + .updateTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateTlsInspectionPolicy()`. + * @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/network_security.update_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async + */ + async checkUpdateTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the TlsInspectionPolicy to delete. Must be in the - * format - * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. - * @param {boolean} request.force - * If set to true, any rules for this TlsInspectionPolicy will also be - * deleted. (Otherwise, the request will only work if the TlsInspectionPolicy - * has no rules.) - * @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/network_security.delete_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async - */ + /** + * Deletes a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the TlsInspectionPolicy to delete. Must be in the + * format + * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. + * @param {boolean} request.force + * If set to true, any rules for this TlsInspectionPolicy will also be + * deleted. (Otherwise, the request will only work if the TlsInspectionPolicy + * has no rules.) + * @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/network_security.delete_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async + */ deleteTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteTlsInspectionPolicy request %j', request); - return this.innerApiCalls.deleteTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteTlsInspectionPolicy()`. - * @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/network_security.delete_tls_inspection_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async - */ - async checkDeleteTlsInspectionPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteTlsInspectionPolicy()`. + * @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/network_security.delete_tls_inspection_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async + */ + async checkDeleteTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new AuthzPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the `AuthzPolicy` resource. Must be in - * the format `projects/{project}/locations/{location}`. - * @param {string} request.authzPolicyId - * Required. User-provided ID of the `AuthzPolicy` resource to be created. - * @param {google.cloud.networksecurity.v1.AuthzPolicy} request.authzPolicy - * Required. `AuthzPolicy` resource to be created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/network_security.create_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthzPolicy_async - */ + /** + * Creates a new AuthzPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the `AuthzPolicy` resource. Must be in + * the format `projects/{project}/locations/{location}`. + * @param {string} request.authzPolicyId + * Required. User-provided ID of the `AuthzPolicy` resource to be created. + * @param {google.cloud.networksecurity.v1.AuthzPolicy} request.authzPolicy + * Required. `AuthzPolicy` resource to be created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/network_security.create_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthzPolicy_async + */ createAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAuthzPolicy request %j', request); - return this.innerApiCalls.createAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAuthzPolicy()`. - * @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/network_security.create_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthzPolicy_async - */ - async checkCreateAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAuthzPolicy()`. + * @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/network_security.create_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_CreateAuthzPolicy_async + */ + async checkCreateAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AuthzPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AuthzPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Used to specify the fields to be overwritten in the - * `AuthzPolicy` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field is overwritten if it is in the mask. If the - * user does not specify a mask, then all fields are overwritten. - * @param {google.cloud.networksecurity.v1.AuthzPolicy} request.authzPolicy - * Required. `AuthzPolicy` resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/network_security.update_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthzPolicy_async - */ + /** + * Updates the parameters of a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Used to specify the fields to be overwritten in the + * `AuthzPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @param {google.cloud.networksecurity.v1.AuthzPolicy} request.authzPolicy + * Required. `AuthzPolicy` resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/network_security.update_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthzPolicy_async + */ updateAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'authz_policy.name': request.authzPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'authz_policy.name': request.authzPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAuthzPolicy request %j', request); - return this.innerApiCalls.updateAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAuthzPolicy()`. - * @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/network_security.update_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthzPolicy_async - */ - async checkUpdateAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAuthzPolicy()`. + * @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/network_security.update_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_UpdateAuthzPolicy_async + */ + async checkUpdateAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AuthzPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AuthzPolicy, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `AuthzPolicy` resource to delete. Must be in - * the format - * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/network_security.delete_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthzPolicy_async - */ + /** + * Deletes a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `AuthzPolicy` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/network_security.delete_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthzPolicy_async + */ deleteAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthzPolicy( - request: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAuthzPolicy request %j', request); - return this.innerApiCalls.deleteAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAuthzPolicy()`. - * @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/network_security.delete_authz_policy.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthzPolicy_async - */ - async checkDeleteAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAuthzPolicy()`. + * @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/network_security.delete_authz_policy.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_DeleteAuthzPolicy_async + */ + async checkDeleteAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists AuthorizationPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. - * 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists AuthorizationPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. + * 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse, + ] + >; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAuthorizationPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -4718,204 +7322,233 @@ export class NetworkSecurityClient { this._log.info('listAuthorizationPolicies request %j', request); return this.innerApiCalls .listAuthorizationPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse - ]) => { - this._log.info('listAuthorizationPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesResponse, + ]) => { + this._log.info('listAuthorizationPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies stream %j', request); return this.descriptors.page.listAuthorizationPolicies.createStream( this.innerApiCalls.listAuthorizationPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. 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/network_security.list_authorization_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListAuthorizationPolicies_async - */ + /** + * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.AuthorizationPolicy|AuthorizationPolicy}. 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/network_security.list_authorization_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListAuthorizationPolicies_async + */ listAuthorizationPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies iterate %j', request); return this.descriptors.page.listAuthorizationPolicies.asyncIterate( this.innerApiCalls['listAuthorizationPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists BackendAuthenticationConfigs in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. - * 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 `listBackendAuthenticationConfigsAsync()` - * 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. - */ + /** + * Lists BackendAuthenticationConfigs in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. + * 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 `listBackendAuthenticationConfigsAsync()` + * 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. + */ listBackendAuthenticationConfigs( - request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse, + ] + >; listBackendAuthenticationConfigs( - request: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig>): void; + request: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig + >, + ): void; listBackendAuthenticationConfigs( - request: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig>): void; + request: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig + >, + ): void; listBackendAuthenticationConfigs( - request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig>): - Promise<[ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listBackendAuthenticationConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -4924,209 +7557,243 @@ export class NetworkSecurityClient { this._log.info('listBackendAuthenticationConfigs request %j', request); return this.innerApiCalls .listBackendAuthenticationConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse - ]) => { - this._log.info('listBackendAuthenticationConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsResponse, + ]) => { + this._log.info( + 'listBackendAuthenticationConfigs values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listBackendAuthenticationConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig} 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 `listBackendAuthenticationConfigsAsync()` - * 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. - */ + /** + * Equivalent to `listBackendAuthenticationConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig} 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 `listBackendAuthenticationConfigsAsync()` + * 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. + */ listBackendAuthenticationConfigsStream( - request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + 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['listBackendAuthenticationConfigs']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listBackendAuthenticationConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackendAuthenticationConfigs stream %j', request); return this.descriptors.page.listBackendAuthenticationConfigs.createStream( this.innerApiCalls.listBackendAuthenticationConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listBackendAuthenticationConfigs`, 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 project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. 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/network_security.list_backend_authentication_configs.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListBackendAuthenticationConfigs_async - */ + /** + * Equivalent to `listBackendAuthenticationConfigs`, 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 project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.BackendAuthenticationConfig|BackendAuthenticationConfig}. 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/network_security.list_backend_authentication_configs.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListBackendAuthenticationConfigs_async + */ listBackendAuthenticationConfigsAsync( - request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListBackendAuthenticationConfigsRequest, + 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['listBackendAuthenticationConfigs']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listBackendAuthenticationConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackendAuthenticationConfigs iterate %j', request); return this.descriptors.page.listBackendAuthenticationConfigs.asyncIterate( this.innerApiCalls['listBackendAuthenticationConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ServerTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. - * 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ServerTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. + * 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse, + ] + >; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IServerTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IServerTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IServerTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IServerTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IServerTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IServerTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listServerTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5135,213 +7802,242 @@ export class NetworkSecurityClient { this._log.info('listServerTlsPolicies request %j', request); return this.innerApiCalls .listServerTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse - ]) => { - this._log.info('listServerTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesResponse, + ]) => { + this._log.info('listServerTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies stream %j', request); return this.descriptors.page.listServerTlsPolicies.createStream( this.innerApiCalls.listServerTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. 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/network_security.list_server_tls_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListServerTlsPolicies_async - */ + /** + * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1.ServerTlsPolicy|ServerTlsPolicy}. 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/network_security.list_server_tls_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListServerTlsPolicies_async + */ listServerTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies iterate %j', request); return this.descriptors.page.listServerTlsPolicies.asyncIterate( this.innerApiCalls['listServerTlsPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ClientTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. - * 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ClientTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. + * 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse, + ] + >; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IClientTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IClientTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IClientTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IClientTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IClientTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IClientTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listClientTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5350,202 +8046,231 @@ export class NetworkSecurityClient { this._log.info('listClientTlsPolicies request %j', request); return this.innerApiCalls .listClientTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse - ]) => { - this._log.info('listClientTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesResponse, + ]) => { + this._log.info('listClientTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies stream %j', request); return this.descriptors.page.listClientTlsPolicies.createStream( this.innerApiCalls.listClientTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. 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/network_security.list_client_tls_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListClientTlsPolicies_async - */ + /** + * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.ClientTlsPolicy|ClientTlsPolicy}. 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/network_security.list_client_tls_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListClientTlsPolicies_async + */ listClientTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies iterate %j', request); return this.descriptors.page.listClientTlsPolicies.asyncIterate( this.innerApiCalls['listClientTlsPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists GatewaySecurityPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. - * 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 `listGatewaySecurityPoliciesAsync()` - * 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. - */ + /** + * Lists GatewaySecurityPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. + * 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 `listGatewaySecurityPoliciesAsync()` + * 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. + */ listGatewaySecurityPolicies( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse, + ] + >; listGatewaySecurityPolicies( - request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy + >, + ): void; listGatewaySecurityPolicies( - request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy + >, + ): void; listGatewaySecurityPolicies( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGatewaySecurityPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5554,204 +8279,233 @@ export class NetworkSecurityClient { this._log.info('listGatewaySecurityPolicies request %j', request); return this.innerApiCalls .listGatewaySecurityPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse - ]) => { - this._log.info('listGatewaySecurityPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesResponse, + ]) => { + this._log.info('listGatewaySecurityPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGatewaySecurityPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy} 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 `listGatewaySecurityPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listGatewaySecurityPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy} 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 `listGatewaySecurityPoliciesAsync()` + * 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. + */ listGatewaySecurityPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGatewaySecurityPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicies stream %j', request); return this.descriptors.page.listGatewaySecurityPolicies.createStream( this.innerApiCalls.listGatewaySecurityPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGatewaySecurityPolicies`, 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 project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. 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/network_security.list_gateway_security_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListGatewaySecurityPolicies_async - */ + /** + * Equivalent to `listGatewaySecurityPolicies`, 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 project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicy|GatewaySecurityPolicy}. 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/network_security.list_gateway_security_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListGatewaySecurityPolicies_async + */ listGatewaySecurityPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGatewaySecurityPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicies iterate %j', request); return this.descriptors.page.listGatewaySecurityPolicies.asyncIterate( this.innerApiCalls['listGatewaySecurityPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists GatewaySecurityPolicyRules in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. - * 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 `listGatewaySecurityPolicyRulesAsync()` - * 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. - */ + /** + * Lists GatewaySecurityPolicyRules in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. + * 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 `listGatewaySecurityPolicyRulesAsync()` + * 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. + */ listGatewaySecurityPolicyRules( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse, + ] + >; listGatewaySecurityPolicyRules( - request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule>): void; + request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule + >, + ): void; listGatewaySecurityPolicyRules( - request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule>): void; + request: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule + >, + ): void; listGatewaySecurityPolicyRules( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule>): - Promise<[ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGatewaySecurityPolicyRules values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5760,204 +8514,235 @@ export class NetworkSecurityClient { this._log.info('listGatewaySecurityPolicyRules request %j', request); return this.innerApiCalls .listGatewaySecurityPolicyRules(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse - ]) => { - this._log.info('listGatewaySecurityPolicyRules values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesResponse, + ]) => { + this._log.info('listGatewaySecurityPolicyRules values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGatewaySecurityPolicyRules`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule} 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 `listGatewaySecurityPolicyRulesAsync()` - * 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. - */ + /** + * Equivalent to `listGatewaySecurityPolicyRules`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule} 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 `listGatewaySecurityPolicyRulesAsync()` + * 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. + */ listGatewaySecurityPolicyRulesStream( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + 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['listGatewaySecurityPolicyRules']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listGatewaySecurityPolicyRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicyRules stream %j', request); return this.descriptors.page.listGatewaySecurityPolicyRules.createStream( this.innerApiCalls.listGatewaySecurityPolicyRules as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGatewaySecurityPolicyRules`, 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 project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. 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/network_security.list_gateway_security_policy_rules.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListGatewaySecurityPolicyRules_async - */ + /** + * Equivalent to `listGatewaySecurityPolicyRules`, 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 project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. 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/network_security.list_gateway_security_policy_rules.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListGatewaySecurityPolicyRules_async + */ listGatewaySecurityPolicyRulesAsync( - request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListGatewaySecurityPolicyRulesRequest, + 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['listGatewaySecurityPolicyRules']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listGatewaySecurityPolicyRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicyRules iterate %j', request); return this.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate( this.innerApiCalls['listGatewaySecurityPolicyRules'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists UrlLists in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.UrlList|UrlList}. - * 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 `listUrlListsAsync()` - * 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. - */ + /** + * Lists UrlLists in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.UrlList|UrlList}. + * 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 `listUrlListsAsync()` + * 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. + */ listUrlLists( - request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IUrlList[], - protos.google.cloud.networksecurity.v1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IUrlList[], + protos.google.cloud.networksecurity.v1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1.IListUrlListsResponse, + ] + >; listUrlLists( - request: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IUrlList>): void; + request: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IUrlList + >, + ): void; listUrlLists( - request: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IUrlList>): void; + request: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IUrlList + >, + ): void; listUrlLists( - request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IUrlList>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IUrlList>): - Promise<[ - protos.google.cloud.networksecurity.v1.IUrlList[], - protos.google.cloud.networksecurity.v1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IUrlList + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IUrlList + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IUrlList[], + protos.google.cloud.networksecurity.v1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1.IListUrlListsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IUrlList>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IUrlList + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listUrlLists values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5966,204 +8751,233 @@ export class NetworkSecurityClient { this._log.info('listUrlLists request %j', request); return this.innerApiCalls .listUrlLists(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IUrlList[], - protos.google.cloud.networksecurity.v1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1.IListUrlListsResponse - ]) => { - this._log.info('listUrlLists values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IUrlList[], + protos.google.cloud.networksecurity.v1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1.IListUrlListsResponse, + ]) => { + this._log.info('listUrlLists values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listUrlLists`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.UrlList|UrlList} 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 `listUrlListsAsync()` - * 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. - */ + /** + * Equivalent to `listUrlLists`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.UrlList|UrlList} 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 `listUrlListsAsync()` + * 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. + */ listUrlListsStream( - request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUrlLists']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUrlLists stream %j', request); return this.descriptors.page.listUrlLists.createStream( this.innerApiCalls.listUrlLists as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listUrlLists`, 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 project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1.UrlList|UrlList}. 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/network_security.list_url_lists.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListUrlLists_async - */ + /** + * Equivalent to `listUrlLists`, 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 project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1.UrlList|UrlList}. 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/network_security.list_url_lists.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListUrlLists_async + */ listUrlListsAsync( - request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListUrlListsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUrlLists']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUrlLists iterate %j', request); return this.descriptors.page.listUrlLists.asyncIterate( this.innerApiCalls['listUrlLists'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists TlsInspectionPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. - * 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 `listTlsInspectionPoliciesAsync()` - * 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. - */ + /** + * Lists TlsInspectionPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. + * 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 `listTlsInspectionPoliciesAsync()` + * 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. + */ listTlsInspectionPolicies( - request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse, + ] + >; listTlsInspectionPolicies( - request: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy + >, + ): void; listTlsInspectionPolicies( - request: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy + >, + ): void; listTlsInspectionPolicies( - request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listTlsInspectionPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6172,206 +8986,235 @@ export class NetworkSecurityClient { this._log.info('listTlsInspectionPolicies request %j', request); return this.innerApiCalls .listTlsInspectionPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse - ]) => { - this._log.info('listTlsInspectionPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesResponse, + ]) => { + this._log.info('listTlsInspectionPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listTlsInspectionPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy} 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 `listTlsInspectionPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listTlsInspectionPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy} 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 `listTlsInspectionPoliciesAsync()` + * 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. + */ listTlsInspectionPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTlsInspectionPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTlsInspectionPolicies stream %j', request); return this.descriptors.page.listTlsInspectionPolicies.createStream( this.innerApiCalls.listTlsInspectionPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listTlsInspectionPolicies`, 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 project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. 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/network_security.list_tls_inspection_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListTlsInspectionPolicies_async - */ + /** + * Equivalent to `listTlsInspectionPolicies`, 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 project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.TlsInspectionPolicy|TlsInspectionPolicy}. 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/network_security.list_tls_inspection_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListTlsInspectionPolicies_async + */ listTlsInspectionPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListTlsInspectionPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTlsInspectionPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTlsInspectionPolicies iterate %j', request); return this.descriptors.page.listTlsInspectionPolicies.asyncIterate( this.innerApiCalls['listTlsInspectionPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists AuthzPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. - * 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 `listAuthzPoliciesAsync()` - * 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. - */ + /** + * Lists AuthzPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. + * 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 `listAuthzPoliciesAsync()` + * 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. + */ listAuthzPolicies( - request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse, + ] + >; listAuthzPolicies( - request: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthzPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthzPolicy + >, + ): void; listAuthzPolicies( - request: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthzPolicy>): void; + request: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthzPolicy + >, + ): void; listAuthzPolicies( - request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthzPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthzPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthzPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthzPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAuthzPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAuthzPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAuthzPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6380,147 +9223,151 @@ export class NetworkSecurityClient { this._log.info('listAuthzPolicies request %j', request); return this.innerApiCalls .listAuthzPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse - ]) => { - this._log.info('listAuthzPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1.IListAuthzPoliciesResponse, + ]) => { + this._log.info('listAuthzPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAuthzPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy} 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 `listAuthzPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listAuthzPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy} 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 `listAuthzPoliciesAsync()` + * 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. + */ listAuthzPoliciesStream( - request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthzPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthzPolicies stream %j', request); return this.descriptors.page.listAuthzPolicies.createStream( this.innerApiCalls.listAuthzPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAuthzPolicies`, 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 project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. 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/network_security.list_authz_policies.js - * region_tag:networksecurity_v1_generated_NetworkSecurity_ListAuthzPolicies_async - */ + /** + * Equivalent to `listAuthzPolicies`, 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 project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1.AuthzPolicy|AuthzPolicy}. 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/network_security.list_authz_policies.js + * region_tag:networksecurity_v1_generated_NetworkSecurity_ListAuthzPolicies_async + */ listAuthzPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAuthzPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthzPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthzPolicies iterate %j', request); return this.descriptors.page.listAuthzPolicies.asyncIterate( this.innerApiCalls['listAuthzPolicies'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -6534,40 +9381,40 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -6581,41 +9428,41 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -6629,12 +9476,12 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -6669,12 +9516,11 @@ export class NetworkSecurityClient { | 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. @@ -6707,12 +9553,12 @@ export class NetworkSecurityClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -6755,22 +9601,22 @@ export class NetworkSecurityClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -6805,15 +9651,15 @@ export class NetworkSecurityClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -6847,7 +9693,7 @@ export class NetworkSecurityClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -6860,25 +9706,24 @@ export class NetworkSecurityClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -6917,22 +9762,22 @@ export class NetworkSecurityClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -6948,7 +9793,11 @@ export class NetworkSecurityClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -6964,7 +9813,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -6975,7 +9826,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -6985,8 +9838,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -6997,7 +9854,7 @@ export class NetworkSecurityClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -7013,7 +9870,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -7024,7 +9882,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -7035,7 +9894,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -7046,7 +9906,11 @@ export class NetworkSecurityClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -7061,8 +9925,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -7072,8 +9940,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -7083,8 +9955,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -7095,7 +9971,11 @@ export class NetworkSecurityClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -7111,7 +9991,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -7122,7 +10004,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -7133,7 +10017,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -7144,7 +10030,11 @@ export class NetworkSecurityClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -7160,7 +10050,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -7171,7 +10063,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -7181,8 +10075,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -7193,7 +10091,11 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -7208,8 +10110,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -7219,8 +10125,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -7230,8 +10140,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -7242,7 +10156,11 @@ export class NetworkSecurityClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -7258,7 +10176,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -7268,8 +10188,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -7279,8 +10203,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -7292,7 +10220,12 @@ export class NetworkSecurityClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -7308,8 +10241,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -7319,8 +10256,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -7330,8 +10271,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -7341,8 +10286,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -7353,7 +10302,11 @@ export class NetworkSecurityClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -7369,7 +10322,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -7380,7 +10335,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -7390,8 +10347,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -7402,7 +10363,11 @@ export class NetworkSecurityClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -7417,8 +10382,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -7428,8 +10397,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -7439,8 +10412,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -7451,7 +10428,11 @@ export class NetworkSecurityClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -7466,8 +10447,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -7477,8 +10462,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -7488,8 +10477,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -7500,12 +10493,18 @@ export class NetworkSecurityClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -7515,8 +10514,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -7526,8 +10529,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -7537,8 +10544,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -7549,7 +10560,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -7565,7 +10580,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -7576,7 +10593,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -7586,8 +10605,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -7598,7 +10621,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -7613,8 +10640,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -7624,8 +10655,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -7635,8 +10670,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -7647,7 +10686,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -7662,8 +10705,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -7673,8 +10720,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -7684,8 +10735,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -7696,12 +10751,18 @@ export class NetworkSecurityClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -7711,8 +10772,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -7722,8 +10787,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -7733,8 +10802,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -7745,12 +10818,18 @@ export class NetworkSecurityClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -7760,8 +10839,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -7771,8 +10854,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -7782,8 +10869,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -7794,12 +10885,18 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -7809,8 +10906,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -7820,8 +10921,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -7831,8 +10936,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -7843,12 +10952,18 @@ export class NetworkSecurityClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -7858,8 +10973,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -7869,8 +10988,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -7880,8 +11003,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -7892,12 +11019,18 @@ export class NetworkSecurityClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -7907,8 +11040,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -7918,8 +11055,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -7929,8 +11070,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -7941,7 +11086,11 @@ export class NetworkSecurityClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -7956,8 +11105,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -7967,8 +11120,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -7978,8 +11135,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -7990,12 +11151,18 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -8005,8 +11172,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -8016,8 +11187,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -8027,8 +11202,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -8039,12 +11218,18 @@ export class NetworkSecurityClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -8054,8 +11239,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -8065,8 +11254,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -8076,8 +11269,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -8088,12 +11285,18 @@ export class NetworkSecurityClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -8103,8 +11306,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -8114,8 +11321,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -8125,8 +11336,114 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -8137,7 +11454,11 @@ export class NetworkSecurityClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -8153,7 +11474,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -8164,7 +11487,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -8175,7 +11500,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -8186,7 +11513,11 @@ export class NetworkSecurityClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -8202,7 +11533,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -8213,7 +11546,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -8223,8 +11558,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -8235,7 +11574,7 @@ export class NetworkSecurityClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -8284,15 +11623,19 @@ export class NetworkSecurityClient { */ close(): Promise { if (this.networkSecurityStub && !this._terminated) { - return this.networkSecurityStub.then(stub => { + return this.networkSecurityStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/network_security_proto_list.json b/packages/google-cloud-networksecurity/src/v1/network_security_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/network_security_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/network_security_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_client.ts b/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_client.ts index 7ff2cd21c11c..8ac3978fb08e 100644 --- a/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +59,7 @@ export class OrganizationAddressGroupServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -59,12 +72,12 @@ export class OrganizationAddressGroupServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - organizationAddressGroupServiceStub?: Promise<{[name: string]: Function}>; + organizationAddressGroupServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of OrganizationAddressGroupServiceClient. @@ -105,21 +118,43 @@ export class OrganizationAddressGroupServiceClient { * const client = new OrganizationAddressGroupServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof OrganizationAddressGroupServiceClient; - 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 staticMembers = this + .constructor as typeof OrganizationAddressGroupServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -144,7 +179,7 @@ export class OrganizationAddressGroupServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,18 +192,14 @@ export class OrganizationAddressGroupServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -190,91 +221,106 @@ export class OrganizationAddressGroupServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -282,10 +328,16 @@ export class OrganizationAddressGroupServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAddressGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'addressGroups'), - listAddressGroupReferences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'addressGroupReferences') + listAddressGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'addressGroups', + ), + listAddressGroupReferences: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'addressGroupReferences', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -294,78 +346,215 @@ export class OrganizationAddressGroupServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createAddressGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const createAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateAddressGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const updateAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const addAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const addAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const removeAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const removeAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const cloneAddressGroupItemsResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.AddressGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.AddressGroup', + ) as gax.protobuf.Type; const cloneAddressGroupItemsMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAddressGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAddressGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createAddressGroupResponse.decode.bind(createAddressGroupResponse), - createAddressGroupMetadata.decode.bind(createAddressGroupMetadata)), + createAddressGroupMetadata.decode.bind(createAddressGroupMetadata), + ), updateAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAddressGroupResponse.decode.bind(updateAddressGroupResponse), - updateAddressGroupMetadata.decode.bind(updateAddressGroupMetadata)), + updateAddressGroupMetadata.decode.bind(updateAddressGroupMetadata), + ), addAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, addAddressGroupItemsResponse.decode.bind(addAddressGroupItemsResponse), - addAddressGroupItemsMetadata.decode.bind(addAddressGroupItemsMetadata)), + addAddressGroupItemsMetadata.decode.bind(addAddressGroupItemsMetadata), + ), removeAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - removeAddressGroupItemsResponse.decode.bind(removeAddressGroupItemsResponse), - removeAddressGroupItemsMetadata.decode.bind(removeAddressGroupItemsMetadata)), + removeAddressGroupItemsResponse.decode.bind( + removeAddressGroupItemsResponse, + ), + removeAddressGroupItemsMetadata.decode.bind( + removeAddressGroupItemsMetadata, + ), + ), cloneAddressGroupItems: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - cloneAddressGroupItemsResponse.decode.bind(cloneAddressGroupItemsResponse), - cloneAddressGroupItemsMetadata.decode.bind(cloneAddressGroupItemsMetadata)), + cloneAddressGroupItemsResponse.decode.bind( + cloneAddressGroupItemsResponse, + ), + cloneAddressGroupItemsMetadata.decode.bind( + cloneAddressGroupItemsMetadata, + ), + ), deleteAddressGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAddressGroupResponse.decode.bind(deleteAddressGroupResponse), - deleteAddressGroupMetadata.decode.bind(deleteAddressGroupMetadata)) + deleteAddressGroupMetadata.decode.bind(deleteAddressGroupMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.OrganizationAddressGroupService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.OrganizationAddressGroupService', + 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 @@ -396,28 +585,44 @@ export class OrganizationAddressGroupServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.OrganizationAddressGroupService. this.organizationAddressGroupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.OrganizationAddressGroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1.OrganizationAddressGroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.OrganizationAddressGroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .OrganizationAddressGroupService, + 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 organizationAddressGroupServiceStubMethods = - ['listAddressGroups', 'getAddressGroup', 'createAddressGroup', 'updateAddressGroup', 'addAddressGroupItems', 'removeAddressGroupItems', 'cloneAddressGroupItems', 'deleteAddressGroup', 'listAddressGroupReferences']; + const organizationAddressGroupServiceStubMethods = [ + 'listAddressGroups', + 'getAddressGroup', + 'createAddressGroup', + 'updateAddressGroup', + 'addAddressGroupItems', + 'removeAddressGroupItems', + 'cloneAddressGroupItems', + 'deleteAddressGroup', + 'listAddressGroupReferences', + ]; for (const methodName of organizationAddressGroupServiceStubMethods) { const callPromise = this.organizationAddressGroupServiceStub.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) => () => { + (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] || @@ -427,7 +632,7 @@ export class OrganizationAddressGroupServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -442,8 +647,14 @@ export class OrganizationAddressGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -454,8 +665,14 @@ export class OrganizationAddressGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -486,9 +703,7 @@ export class OrganizationAddressGroupServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -497,8 +712,9 @@ export class OrganizationAddressGroupServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -509,941 +725,1387 @@ export class OrganizationAddressGroupServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AddressGroup to get. Must be in the format - * `projects/* /locations/{location}/addressGroups/*`. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. - * 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/organization_address_group_service.get_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_GetAddressGroup_async - */ + /** + * Gets details of a single address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AddressGroup to get. Must be in the format + * `projects/* /locations/{location}/addressGroups/*`. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. + * 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/organization_address_group_service.get_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_GetAddressGroup_async + */ getAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ] + >; getAddressGroup( - request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAddressGroup( - request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAddressGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.IAddressGroup, + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAddressGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAddressGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.IAddressGroup, - protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAddressGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.IAddressGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetAddressGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAddressGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new address group in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the AddressGroup. Must be in the - * format `projects/* /locations/{location}`. - * @param {string} request.addressGroupId - * Required. Short name of the AddressGroup resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "authz_policy". - * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup - * Required. AddressGroup resource to be created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.create_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CreateAddressGroup_async - */ + /** + * Creates a new address group in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the AddressGroup. Must be in the + * format `projects/* /locations/{location}`. + * @param {string} request.addressGroupId + * Required. Short name of the AddressGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "authz_policy". + * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup + * Required. AddressGroup resource to be created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.create_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CreateAddressGroup_async + */ createAddressGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAddressGroup( - request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAddressGroup( - request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAddressGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAddressGroup request %j', request); - return this.innerApiCalls.createAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAddressGroup()`. - * @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/organization_address_group_service.create_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CreateAddressGroup_async - */ - async checkCreateAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAddressGroup()`. + * @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/organization_address_group_service.create_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CreateAddressGroup_async + */ + async checkCreateAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates parameters of an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * AddressGroup resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup - * Required. Updated AddressGroup resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.update_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_UpdateAddressGroup_async - */ + /** + * Updates parameters of an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * AddressGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1.AddressGroup} request.addressGroup + * Required. Updated AddressGroup resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.update_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_UpdateAddressGroup_async + */ updateAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAddressGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAddressGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group.name': request.addressGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'address_group.name': request.addressGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAddressGroup request %j', request); - return this.innerApiCalls.updateAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAddressGroup()`. - * @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/organization_address_group_service.update_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_UpdateAddressGroup_async - */ - async checkUpdateAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAddressGroup()`. + * @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/organization_address_group_service.update_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_UpdateAddressGroup_async + */ + async checkUpdateAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Adds items to an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to add items to. Must be in the format - * `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string[]} request.items - * Required. List of items to add. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.add_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_AddAddressGroupItems_async - */ + /** + * Adds items to an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to add items to. Must be in the format + * `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string[]} request.items + * Required. List of items to add. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.add_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_AddAddressGroupItems_async + */ addAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; addAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IAddAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('addAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('addAddressGroupItems request %j', request); - return this.innerApiCalls.addAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .addAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('addAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `addAddressGroupItems()`. - * @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/organization_address_group_service.add_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_AddAddressGroupItems_async - */ - async checkAddAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `addAddressGroupItems()`. + * @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/organization_address_group_service.add_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_AddAddressGroupItems_async + */ + async checkAddAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('addAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.addAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.addAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Removes items from an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to remove items from. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string[]} request.items - * Required. List of items to remove. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.remove_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_RemoveAddressGroupItems_async - */ + /** + * Removes items from an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to remove items from. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string[]} request.items + * Required. List of items to remove. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.remove_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_RemoveAddressGroupItems_async + */ removeAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; removeAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IRemoveAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('removeAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('removeAddressGroupItems request %j', request); - return this.innerApiCalls.removeAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .removeAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('removeAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `removeAddressGroupItems()`. - * @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/organization_address_group_service.remove_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_RemoveAddressGroupItems_async - */ - async checkRemoveAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `removeAddressGroupItems()`. + * @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/organization_address_group_service.remove_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_RemoveAddressGroupItems_async + */ + async checkRemoveAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('removeAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.removeAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.removeAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Clones items from one address group to another. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {string} request.sourceAddressGroup - * Required. Source address group to clone items from. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.clone_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CloneAddressGroupItems_async - */ + /** + * Clones items from one address group to another. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {string} request.sourceAddressGroup + * Required. Source address group to clone items from. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.clone_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CloneAddressGroupItems_async + */ cloneAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cloneAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cloneAddressGroupItems( - request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cloneAddressGroupItems( - request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICloneAddressGroupItemsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cloneAddressGroupItems response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cloneAddressGroupItems request %j', request); - return this.innerApiCalls.cloneAddressGroupItems(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cloneAddressGroupItems response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cloneAddressGroupItems(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cloneAddressGroupItems response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cloneAddressGroupItems()`. - * @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/organization_address_group_service.clone_address_group_items.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CloneAddressGroupItems_async - */ - async checkCloneAddressGroupItemsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cloneAddressGroupItems()`. + * @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/organization_address_group_service.clone_address_group_items.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_CloneAddressGroupItems_async + */ + async checkCloneAddressGroupItemsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('cloneAddressGroupItems long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.cloneAddressGroupItems, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cloneAddressGroupItems, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.AddressGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AddressGroup to delete. Must be in the format - * `projects/* /locations/{location}/addressGroups/*`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/organization_address_group_service.delete_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_DeleteAddressGroup_async - */ + /** + * Deletes an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AddressGroup to delete. Must be in the format + * `projects/* /locations/{location}/addressGroups/*`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/organization_address_group_service.delete_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_DeleteAddressGroup_async + */ deleteAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAddressGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAddressGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAddressGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteAddressGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAddressGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAddressGroup request %j', request); - return this.innerApiCalls.deleteAddressGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAddressGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAddressGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAddressGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAddressGroup()`. - * @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/organization_address_group_service.delete_address_group.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_DeleteAddressGroup_async - */ - async checkDeleteAddressGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAddressGroup()`. + * @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/organization_address_group_service.delete_address_group.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_DeleteAddressGroup_async + */ + async checkDeleteAddressGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteAddressGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAddressGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists address groups in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. - * 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 `listAddressGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAddressGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists address groups in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. + * 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 `listAddressGroupsAsync()` + * 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. + */ listAddressGroups( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ] + >; listAddressGroups( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): void; listAddressGroups( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): void; listAddressGroups( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.IAddressGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.IAddressGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAddressGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1452,211 +2114,240 @@ export class OrganizationAddressGroupServiceClient { this._log.info('listAddressGroups request %j', request); return this.innerApiCalls .listAddressGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.IAddressGroup[], - protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse - ]) => { - this._log.info('listAddressGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.IAddressGroup[], + protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupsResponse, + ]) => { + this._log.info('listAddressGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAddressGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup} 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 `listAddressGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listAddressGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup} 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 `listAddressGroupsAsync()` + * 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. + */ listAddressGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroups stream %j', request); return this.descriptors.page.listAddressGroups.createStream( this.innerApiCalls.listAddressGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAddressGroups`, 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 project and location from which the AddressGroups - * should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AddressGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAddressGroupsResponse` Indicates that this is a - * continuation of a prior `ListAddressGroups` call, and - * that the system should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. If true, allow partial responses for multi-regional Aggregated - * List requests. - * @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.networksecurity.v1.AddressGroup|AddressGroup}. 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/organization_address_group_service.list_address_groups.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_ListAddressGroups_async - */ + /** + * Equivalent to `listAddressGroups`, 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 project and location from which the AddressGroups + * should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AddressGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAddressGroupsResponse` Indicates that this is a + * continuation of a prior `ListAddressGroups` call, and + * that the system should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. If true, allow partial responses for multi-regional Aggregated + * List requests. + * @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.networksecurity.v1.AddressGroup|AddressGroup}. 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/organization_address_group_service.list_address_groups.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_ListAddressGroups_async + */ listAddressGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroups iterate %j', request); return this.descriptors.page.listAddressGroups.asyncIterate( this.innerApiCalls['listAddressGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists references of an address group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. - * 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 `listAddressGroupReferencesAsync()` - * 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. - */ + /** + * Lists references of an address group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. + * 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 `listAddressGroupReferencesAsync()` + * 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. + */ listAddressGroupReferences( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ] + >; listAddressGroupReferences( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): void; listAddressGroupReferences( - request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): void; + request: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): void; listAddressGroupReferences( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>): - Promise<[ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'address_group': request.addressGroup ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + | protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAddressGroupReferences values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1665,145 +2356,149 @@ export class OrganizationAddressGroupServiceClient { this._log.info('listAddressGroupReferences request %j', request); return this.innerApiCalls .listAddressGroupReferences(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest|null, - protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse - ]) => { - this._log.info('listAddressGroupReferences values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[], + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest | null, + protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesResponse, + ]) => { + this._log.info('listAddressGroupReferences values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAddressGroupReferences`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference} 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 `listAddressGroupReferencesAsync()` - * 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. - */ + /** + * Equivalent to `listAddressGroupReferences`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference} 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 `listAddressGroupReferencesAsync()` + * 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. + */ listAddressGroupReferencesStream( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + 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({ - 'address_group': request.addressGroup ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroupReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroupReferences stream %j', request); return this.descriptors.page.listAddressGroupReferences.createStream( this.innerApiCalls.listAddressGroupReferences as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAddressGroupReferences`, 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.addressGroup - * Required. A name of the AddressGroup to clone items to. Must be in the - * format `projects|organization/* /locations/{location}/addressGroups/*`. - * @param {number} request.pageSize - * The maximum number of references to return. If unspecified, server - * will pick an appropriate default. Server may return fewer items than - * requested. A caller should only rely on response's - * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} - * to determine if there are more AddressGroupUsers left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. 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/organization_address_group_service.list_address_group_references.js - * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_ListAddressGroupReferences_async - */ + /** + * Equivalent to `listAddressGroupReferences`, 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.addressGroup + * Required. A name of the AddressGroup to clone items to. Must be in the + * format `projects|organization/* /locations/{location}/addressGroups/*`. + * @param {number} request.pageSize + * The maximum number of references to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * {@link protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token|next_page_token} + * to determine if there are more AddressGroupUsers left to be queried. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, + * if any. + * @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.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference|AddressGroupReference}. 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/organization_address_group_service.list_address_group_references.js + * region_tag:networksecurity_v1_generated_OrganizationAddressGroupService_ListAddressGroupReferences_async + */ listAddressGroupReferencesAsync( - request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListAddressGroupReferencesRequest, + 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({ - 'address_group': request.addressGroup ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + address_group: request.addressGroup ?? '', + }); const defaultCallSettings = this._defaults['listAddressGroupReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAddressGroupReferences iterate %j', request); return this.descriptors.page.listAddressGroupReferences.asyncIterate( this.innerApiCalls['listAddressGroupReferences'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1817,40 +2512,40 @@ export class OrganizationAddressGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1864,41 +2559,41 @@ export class OrganizationAddressGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1912,12 +2607,12 @@ export class OrganizationAddressGroupServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1952,12 +2647,11 @@ export class OrganizationAddressGroupServiceClient { | 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. @@ -1990,12 +2684,12 @@ export class OrganizationAddressGroupServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2038,22 +2732,22 @@ export class OrganizationAddressGroupServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2088,15 +2782,15 @@ export class OrganizationAddressGroupServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2130,7 +2824,7 @@ export class OrganizationAddressGroupServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2143,25 +2837,24 @@ export class OrganizationAddressGroupServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2200,22 +2893,22 @@ export class OrganizationAddressGroupServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2231,7 +2924,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2247,7 +2944,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2258,7 +2957,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2268,8 +2969,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2280,7 +2985,7 @@ export class OrganizationAddressGroupServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2296,7 +3001,8 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2307,7 +3013,8 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2318,7 +3025,8 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2329,7 +3037,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2344,8 +3056,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2355,8 +3071,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2366,8 +3086,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2378,7 +3102,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2394,7 +3122,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2405,7 +3135,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2416,7 +3148,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2427,7 +3161,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2443,7 +3181,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2454,7 +3194,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2464,8 +3206,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2476,7 +3222,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2491,8 +3241,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2502,8 +3256,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2513,8 +3271,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2525,7 +3287,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2541,7 +3307,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2551,8 +3319,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2562,8 +3334,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2575,7 +3351,12 @@ export class OrganizationAddressGroupServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2591,8 +3372,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2602,8 +3387,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2613,8 +3402,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2624,8 +3417,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2636,7 +3433,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2652,7 +3453,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2663,7 +3466,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2673,8 +3478,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2685,7 +3494,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2700,8 +3513,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2711,8 +3528,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2722,8 +3543,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2734,7 +3559,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2749,8 +3578,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2760,8 +3593,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2771,8 +3608,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2783,12 +3624,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2798,8 +3645,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2809,8 +3660,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2820,8 +3675,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2831,7 +3690,7 @@ export class OrganizationAddressGroupServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2868,7 +3727,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2884,7 +3747,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2895,7 +3760,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2905,8 +3772,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -2917,7 +3788,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2932,8 +3807,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -2943,8 +3822,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -2954,8 +3837,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -2966,7 +3853,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2981,8 +3872,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2992,8 +3887,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -3003,8 +3902,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -3015,12 +3918,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3030,8 +3939,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3041,8 +3954,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3052,8 +3969,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3064,12 +3985,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -3079,8 +4006,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -3090,8 +4021,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -3101,8 +4036,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -3113,12 +4052,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3128,8 +4073,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3139,8 +4088,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3150,8 +4103,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3162,12 +4119,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3177,8 +4140,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3188,8 +4155,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3199,8 +4170,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3211,12 +4186,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3226,8 +4207,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3237,8 +4222,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3248,8 +4237,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3258,7 +4251,7 @@ export class OrganizationAddressGroupServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3283,7 +4276,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -3298,8 +4295,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -3309,8 +4310,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -3320,8 +4325,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -3332,12 +4341,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3347,8 +4362,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3358,8 +4377,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3369,8 +4392,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3381,12 +4408,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3396,8 +4429,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3407,8 +4444,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3418,8 +4459,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3430,12 +4475,18 @@ export class OrganizationAddressGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3445,8 +4496,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3456,8 +4511,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3467,8 +4526,114 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3479,7 +4644,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3495,7 +4664,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3506,7 +4677,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3517,7 +4690,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3528,7 +4703,11 @@ export class OrganizationAddressGroupServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3544,7 +4723,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3555,7 +4736,9 @@ export class OrganizationAddressGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3565,8 +4748,12 @@ export class OrganizationAddressGroupServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3577,7 +4764,7 @@ export class OrganizationAddressGroupServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3626,15 +4813,19 @@ export class OrganizationAddressGroupServiceClient { */ close(): Promise { if (this.organizationAddressGroupServiceStub && !this._terminated) { - return this.organizationAddressGroupServiceStub.then(stub => { + return this.organizationAddressGroupServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/organization_address_group_service_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_client.ts b/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_client.ts index 9b711ea83e16..9d102fe59e7f 100644 --- a/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class OrganizationSecurityProfileGroupServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,14 @@ export class OrganizationSecurityProfileGroupServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - organizationSecurityProfileGroupServiceStub?: Promise<{[name: string]: Function}>; + organizationSecurityProfileGroupServiceStub?: Promise<{ + [name: string]: Function; + }>; /** * Construct an instance of OrganizationSecurityProfileGroupServiceClient. @@ -103,21 +118,43 @@ export class OrganizationSecurityProfileGroupServiceClient { * const client = new OrganizationSecurityProfileGroupServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof OrganizationSecurityProfileGroupServiceClient; - 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 staticMembers = this + .constructor as typeof OrganizationSecurityProfileGroupServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +179,7 @@ export class OrganizationSecurityProfileGroupServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +192,14 @@ export class OrganizationSecurityProfileGroupServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,91 +221,106 @@ export class OrganizationSecurityProfileGroupServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' + 'organizations/{organization}', ), organizationLocationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}' - ), - organizationLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/addressGroups/{address_group}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'organizations/{organization}/locations/{location}', ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/addressGroups/{address_group}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' + 'projects/{project}/locations/{location}/addressGroups/{address_group}', ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -280,10 +328,16 @@ export class OrganizationSecurityProfileGroupServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listSecurityProfileGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityProfileGroups'), - listSecurityProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityProfiles') + listSecurityProfileGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfileGroups', + ), + listSecurityProfiles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfiles', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -292,78 +346,231 @@ export class OrganizationSecurityProfileGroupServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + 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/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',},{get: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.SecurityProfileGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.SecurityProfileGroup', + ) as gax.protobuf.Type; const createSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.SecurityProfileGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.SecurityProfileGroup', + ) as gax.protobuf.Type; const updateSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const createSecurityProfileResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.SecurityProfile') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.SecurityProfile', + ) as gax.protobuf.Type; const createSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateSecurityProfileResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.SecurityProfile') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.SecurityProfile', + ) as gax.protobuf.Type; const updateSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSecurityProfileResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createSecurityProfileGroupResponse.decode.bind(createSecurityProfileGroupResponse), - createSecurityProfileGroupMetadata.decode.bind(createSecurityProfileGroupMetadata)), + createSecurityProfileGroupResponse.decode.bind( + createSecurityProfileGroupResponse, + ), + createSecurityProfileGroupMetadata.decode.bind( + createSecurityProfileGroupMetadata, + ), + ), updateSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateSecurityProfileGroupResponse.decode.bind(updateSecurityProfileGroupResponse), - updateSecurityProfileGroupMetadata.decode.bind(updateSecurityProfileGroupMetadata)), + updateSecurityProfileGroupResponse.decode.bind( + updateSecurityProfileGroupResponse, + ), + updateSecurityProfileGroupMetadata.decode.bind( + updateSecurityProfileGroupMetadata, + ), + ), deleteSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteSecurityProfileGroupResponse.decode.bind(deleteSecurityProfileGroupResponse), - deleteSecurityProfileGroupMetadata.decode.bind(deleteSecurityProfileGroupMetadata)), + deleteSecurityProfileGroupResponse.decode.bind( + deleteSecurityProfileGroupResponse, + ), + deleteSecurityProfileGroupMetadata.decode.bind( + deleteSecurityProfileGroupMetadata, + ), + ), createSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createSecurityProfileResponse.decode.bind(createSecurityProfileResponse), - createSecurityProfileMetadata.decode.bind(createSecurityProfileMetadata)), + createSecurityProfileResponse.decode.bind( + createSecurityProfileResponse, + ), + createSecurityProfileMetadata.decode.bind( + createSecurityProfileMetadata, + ), + ), updateSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateSecurityProfileResponse.decode.bind(updateSecurityProfileResponse), - updateSecurityProfileMetadata.decode.bind(updateSecurityProfileMetadata)), + updateSecurityProfileResponse.decode.bind( + updateSecurityProfileResponse, + ), + updateSecurityProfileMetadata.decode.bind( + updateSecurityProfileMetadata, + ), + ), deleteSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteSecurityProfileResponse.decode.bind(deleteSecurityProfileResponse), - deleteSecurityProfileMetadata.decode.bind(deleteSecurityProfileMetadata)) + deleteSecurityProfileResponse.decode.bind( + deleteSecurityProfileResponse, + ), + deleteSecurityProfileMetadata.decode.bind( + deleteSecurityProfileMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService', + 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 @@ -394,28 +601,45 @@ export class OrganizationSecurityProfileGroupServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService. this.organizationSecurityProfileGroupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.OrganizationSecurityProfileGroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .OrganizationSecurityProfileGroupService, + 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 organizationSecurityProfileGroupServiceStubMethods = - ['listSecurityProfileGroups', 'getSecurityProfileGroup', 'createSecurityProfileGroup', 'updateSecurityProfileGroup', 'deleteSecurityProfileGroup', 'listSecurityProfiles', 'getSecurityProfile', 'createSecurityProfile', 'updateSecurityProfile', 'deleteSecurityProfile']; + const organizationSecurityProfileGroupServiceStubMethods = [ + 'listSecurityProfileGroups', + 'getSecurityProfileGroup', + 'createSecurityProfileGroup', + 'updateSecurityProfileGroup', + 'deleteSecurityProfileGroup', + 'listSecurityProfiles', + 'getSecurityProfile', + 'createSecurityProfile', + 'updateSecurityProfile', + 'deleteSecurityProfile', + ]; for (const methodName of organizationSecurityProfileGroupServiceStubMethods) { const callPromise = this.organizationSecurityProfileGroupServiceStub.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) => () => { + (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] || @@ -425,7 +649,7 @@ export class OrganizationSecurityProfileGroupServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -440,8 +664,14 @@ export class OrganizationSecurityProfileGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -452,8 +682,14 @@ export class OrganizationSecurityProfileGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -484,9 +720,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -495,8 +729,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -507,960 +742,1455 @@ export class OrganizationSecurityProfileGroupServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfileGroup to get. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. - * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. - * 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/organization_security_profile_group_service.get_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfileGroup_async - */ + /** + * Gets details of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. + * 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/organization_security_profile_group_service.get_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfileGroup_async + */ getSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ] + >; getSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSecurityProfileGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSecurityProfileGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSecurityProfileGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfileGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfile to get. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. - * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. - * 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/organization_security_profile_group_service.get_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfile_async - */ + /** + * Gets details of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. + * 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/organization_security_profile_group_service.get_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfile_async + */ getSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ] + >; getSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSecurityProfile request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSecurityProfile response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSecurityProfile(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1.ISecurityProfile, - protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSecurityProfile response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfile response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new SecurityProfileGroup in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the SecurityProfileGroup. Must be in the - * format `projects|organizations/* /locations/{location}`. - * @param {string} request.securityProfileGroupId - * Required. Short name of the SecurityProfileGroup resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "security_profile_group1". - * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup - * Required. SecurityProfileGroup resource to be created. - * @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/organization_security_profile_group_service.create_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async - */ + /** + * Creates a new SecurityProfileGroup in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfileGroup. Must be in the + * format `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileGroupId + * Required. Short name of the SecurityProfileGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "security_profile_group1". + * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup + * Required. SecurityProfileGroup resource to be created. + * @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/organization_security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async + */ createSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSecurityProfileGroup request %j', request); - return this.innerApiCalls.createSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSecurityProfileGroup()`. - * @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/organization_security_profile_group_service.create_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async - */ - async checkCreateSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSecurityProfileGroup()`. + * @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/organization_security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async + */ + async checkCreateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * SecurityProfileGroup resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup - * Required. Updated SecurityProfileGroup 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/organization_security_profile_group_service.update_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async - */ + /** + * Updates the parameters of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfileGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup + * Required. Updated SecurityProfileGroup 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/organization_security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ updateSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'security_profile_group.name': request.securityProfileGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'security_profile_group.name': request.securityProfileGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSecurityProfileGroup request %j', request); - return this.innerApiCalls.updateSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSecurityProfileGroup()`. - * @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/organization_security_profile_group_service.update_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async - */ - async checkUpdateSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSecurityProfileGroup()`. + * @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/organization_security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ + async checkUpdateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfileGroup to delete. Must be in the - * format - * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. - * @param {string} [request.etag] - * Optional. If client provided etag is out of date, delete will return - * FAILED_PRECONDITION error. - * @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/organization_security_profile_group_service.delete_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async - */ + /** + * Deletes a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to delete. Must be in the + * format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/organization_security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ deleteSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSecurityProfileGroup request %j', request); - return this.innerApiCalls.deleteSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSecurityProfileGroup()`. - * @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/organization_security_profile_group_service.delete_security_profile_group.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async - */ - async checkDeleteSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSecurityProfileGroup()`. + * @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/organization_security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ + async checkDeleteSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Creates a new SecurityProfile in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the SecurityProfile. Must be in the format - * `projects|organizations/* /locations/{location}`. - * @param {string} request.securityProfileId - * Required. Short name of the SecurityProfile resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "security_profile1". - * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile - * Required. SecurityProfile resource to be created. - * @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/organization_security_profile_group_service.create_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async - */ + /** + * Creates a new SecurityProfile in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfile. Must be in the format + * `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileId + * Required. Short name of the SecurityProfile resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "security_profile1". + * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile + * Required. SecurityProfile resource to be created. + * @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/organization_security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async + */ createSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSecurityProfile( - request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfile( - request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSecurityProfile request %j', request); - return this.innerApiCalls.createSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSecurityProfile()`. - * @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/organization_security_profile_group_service.create_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async - */ - async checkCreateSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSecurityProfile()`. + * @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/organization_security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async + */ + async checkCreateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('createSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * SecurityProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile - * Required. Updated SecurityProfile 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/organization_security_profile_group_service.update_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async - */ + /** + * Updates the parameters of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile + * Required. Updated SecurityProfile 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/organization_security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async + */ updateSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'security_profile.name': request.securityProfile!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'security_profile.name': request.securityProfile!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSecurityProfile request %j', request); - return this.innerApiCalls.updateSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSecurityProfile()`. - * @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/organization_security_profile_group_service.update_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async - */ - async checkUpdateSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSecurityProfile()`. + * @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/organization_security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async + */ + async checkUpdateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('updateSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; } -/** - * Deletes a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfile to delete. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. - * @param {string} [request.etag] - * Optional. If client provided etag is out of date, delete will return - * FAILED_PRECONDITION error. - * @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/organization_security_profile_group_service.delete_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async - */ + /** + * Deletes a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to delete. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/organization_security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async + */ deleteSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfile( - request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfile( - request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSecurityProfile request %j', request); - return this.innerApiCalls.deleteSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSecurityProfile()`. - * @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/organization_security_profile_group_service.delete_security_profile.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async - */ - async checkDeleteSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSecurityProfile()`. + * @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/organization_security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async + */ + async checkDeleteSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { this._log.info('deleteSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists SecurityProfileGroups in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfileGroups to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. - * 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 `listSecurityProfileGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists SecurityProfileGroups in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. + * 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 `listSecurityProfileGroupsAsync()` + * 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. + */ listSecurityProfileGroups( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ] + >; listSecurityProfileGroups( - request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): void; listSecurityProfileGroups( - request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup>): void; + request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): void; listSecurityProfileGroups( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSecurityProfileGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1469,204 +2199,233 @@ export class OrganizationSecurityProfileGroupServiceClient { this._log.info('listSecurityProfileGroups request %j', request); return this.innerApiCalls .listSecurityProfileGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse - ]) => { - this._log.info('listSecurityProfileGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ]) => { + this._log.info('listSecurityProfileGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSecurityProfileGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfileGroups to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup} 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 `listSecurityProfileGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listSecurityProfileGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup} 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 `listSecurityProfileGroupsAsync()` + * 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. + */ listSecurityProfileGroupsStream( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfileGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfileGroups stream %j', request); return this.descriptors.page.listSecurityProfileGroups.createStream( this.innerApiCalls.listSecurityProfileGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSecurityProfileGroups`, 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 project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfileGroups to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. 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/organization_security_profile_group_service.list_security_profile_groups.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfileGroups_async - */ + /** + * Equivalent to `listSecurityProfileGroups`, 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 project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. 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/organization_security_profile_group_service.list_security_profile_groups.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfileGroups_async + */ listSecurityProfileGroupsAsync( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfileGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfileGroups iterate %j', request); return this.descriptors.page.listSecurityProfileGroups.asyncIterate( this.innerApiCalls['listSecurityProfileGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists SecurityProfiles in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfiles to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. - * 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 `listSecurityProfilesAsync()` - * 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. - */ + /** + * Lists SecurityProfiles in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. + * 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 `listSecurityProfilesAsync()` + * 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. + */ listSecurityProfiles( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ] + >; listSecurityProfiles( - request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfile>): void; + request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): void; listSecurityProfiles( - request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfile>): void; + request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): void; listSecurityProfiles( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfile>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfile>): - Promise<[ - protos.google.cloud.networksecurity.v1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1.ISecurityProfile>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSecurityProfiles values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1675,143 +2434,147 @@ export class OrganizationSecurityProfileGroupServiceClient { this._log.info('listSecurityProfiles request %j', request); return this.innerApiCalls .listSecurityProfiles(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse - ]) => { - this._log.info('listSecurityProfiles values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ]) => { + this._log.info('listSecurityProfiles values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSecurityProfiles`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfiles to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1.SecurityProfile|SecurityProfile} 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 `listSecurityProfilesAsync()` - * 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. - */ + /** + * Equivalent to `listSecurityProfiles`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile} 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 `listSecurityProfilesAsync()` + * 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. + */ listSecurityProfilesStream( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfiles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfiles stream %j', request); return this.descriptors.page.listSecurityProfiles.createStream( this.innerApiCalls.listSecurityProfiles as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSecurityProfiles`, 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 project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of SecurityProfiles to return per call. - * @param {string} [request.pageToken] - * Optional. The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. 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/organization_security_profile_group_service.list_security_profiles.js - * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfiles_async - */ + /** + * Equivalent to `listSecurityProfiles`, 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 project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. 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/organization_security_profile_group_service.list_security_profiles.js + * region_tag:networksecurity_v1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfiles_async + */ listSecurityProfilesAsync( - request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfiles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfiles iterate %j', request); return this.descriptors.page.listSecurityProfiles.asyncIterate( this.innerApiCalls['listSecurityProfiles'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1825,40 +2588,40 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1872,41 +2635,41 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1920,12 +2683,12 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1960,12 +2723,11 @@ export class OrganizationSecurityProfileGroupServiceClient { | 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. @@ -1998,12 +2760,12 @@ export class OrganizationSecurityProfileGroupServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2046,22 +2808,22 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2096,15 +2858,15 @@ export class OrganizationSecurityProfileGroupServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2138,7 +2900,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2151,25 +2913,24 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2208,22 +2969,22 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2239,7 +3000,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2255,7 +3020,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2266,7 +3033,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2276,8 +3045,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2288,7 +3061,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2304,7 +3077,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2315,7 +3089,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2326,7 +3101,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2337,7 +3113,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2352,8 +3132,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2363,8 +3147,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2374,8 +3162,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2386,7 +3178,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2402,7 +3198,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2413,7 +3211,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2424,7 +3224,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2435,7 +3237,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2451,7 +3257,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2462,7 +3270,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2472,8 +3282,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2484,7 +3298,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2499,8 +3317,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2510,8 +3332,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2521,8 +3347,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2533,7 +3363,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2549,7 +3383,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2559,8 +3395,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2570,8 +3410,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2583,7 +3427,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2599,8 +3448,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2610,8 +3463,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2621,8 +3478,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2632,8 +3493,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2644,7 +3509,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2660,7 +3529,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2671,7 +3542,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2681,8 +3554,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2693,7 +3570,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2708,8 +3589,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2719,8 +3604,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2730,8 +3619,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2742,7 +3635,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2757,8 +3654,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2768,8 +3669,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2779,8 +3684,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2791,12 +3700,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2806,8 +3721,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2817,8 +3736,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2828,8 +3751,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2840,7 +3767,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2856,7 +3787,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2867,7 +3800,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2877,8 +3812,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -2889,7 +3828,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2904,8 +3847,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -2915,8 +3862,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -2926,8 +3877,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -2938,7 +3893,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2953,8 +3912,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2964,8 +3927,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -2975,8 +3942,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -2987,12 +3958,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3002,8 +3979,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3013,8 +3994,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3024,8 +4009,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3034,7 +4023,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} organization * @returns {string} Resource name string. */ - organizationPath(organization:string) { + organizationPath(organization: string) { return this.pathTemplates.organizationPathTemplate.render({ organization: organization, }); @@ -3048,7 +4037,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; } /** @@ -3058,7 +4048,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} location * @returns {string} Resource name string. */ - organizationLocationPath(organization:string,location:string) { + organizationLocationPath(organization: string, location: string) { return this.pathTemplates.organizationLocationPathTemplate.render({ organization: organization, location: location, @@ -3072,8 +4062,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing OrganizationLocation resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).organization; + matchOrganizationFromOrganizationLocationName( + organizationLocationName: string, + ) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).organization; } /** @@ -3084,7 +4078,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).location; + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).location; } /** @@ -3095,12 +4091,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - organizationLocationAddressGroupPath(organization:string,location:string,addressGroup:string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render({ - organization: organization, - location: location, - address_group: addressGroup, - }); + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); } /** @@ -3110,8 +4112,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).organization; + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; } /** @@ -3121,8 +4127,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).location; + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; } /** @@ -3132,8 +4142,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromOrganizationLocationAddressGroupName(organizationLocationAddressGroupName: string) { - return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match(organizationLocationAddressGroupName).address_group; + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; } /** @@ -3144,12 +4158,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3159,8 +4179,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3170,8 +4194,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3181,8 +4209,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3193,12 +4225,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3208,8 +4246,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3219,8 +4261,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3230,8 +4276,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3242,12 +4292,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3257,8 +4313,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3268,8 +4328,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3279,8 +4343,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3291,7 +4359,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} address_group * @returns {string} Resource name string. */ - projectLocationAddressGroupPath(project:string,location:string,addressGroup:string) { + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ project: project, location: location, @@ -3306,8 +4378,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).project; + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; } /** @@ -3317,8 +4393,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).location; + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; } /** @@ -3328,8 +4408,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_address_group resource. * @returns {string} A string representing the address_group. */ - matchAddressGroupFromProjectLocationAddressGroupName(projectLocationAddressGroupName: string) { - return this.pathTemplates.projectLocationAddressGroupPathTemplate.match(projectLocationAddressGroupName).address_group; + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; } /** @@ -3340,12 +4424,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3355,8 +4445,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3366,8 +4460,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3377,8 +4475,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3389,12 +4491,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3404,8 +4512,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3415,8 +4527,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3426,8 +4542,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3438,12 +4558,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3453,8 +4579,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3464,8 +4594,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3475,8 +4609,114 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3487,7 +4727,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3503,7 +4747,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3514,7 +4760,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3525,7 +4773,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3536,7 +4786,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3552,7 +4806,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3563,7 +4819,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3573,8 +4831,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3585,7 +4847,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3634,15 +4896,19 @@ export class OrganizationSecurityProfileGroupServiceClient { */ close(): Promise { if (this.organizationSecurityProfileGroupServiceStub && !this._terminated) { - return this.organizationSecurityProfileGroupServiceStub.then(stub => { + return this.organizationSecurityProfileGroupServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_proto_list.json index 1451adf6674b..2138f74b5c58 100644 --- a/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_proto_list.json +++ b/packages/google-cloud-networksecurity/src/v1/organization_security_profile_group_service_proto_list.json @@ -19,6 +19,7 @@ "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", "../../protos/google/cloud/networksecurity/v1/tls.proto", "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", "../../protos/google/cloud/networksecurity/v1/url_list.proto" diff --git a/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client.ts b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client.ts new file mode 100644 index 000000000000..63a74134af23 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client.ts @@ -0,0 +1,4560 @@ +// Copyright 2026 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'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/s_s_e_realm_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './s_s_e_realm_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service describing handlers for resources + * @class + * @memberof v1 + */ +export class SSERealmServiceClient { + 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; + private _log = logging.log('network-security'); + + 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; + sSERealmServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SSERealmServiceClient. + * + * @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://cloud.google.com/docs/authentication/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 SSERealmServiceClient({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 SSERealmServiceClient; + 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 = 'networksecurity.' + 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 = { + authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', + ), + authzPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', + ), + backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', + ), + clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', + ), + dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', + ), + firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', + ), + gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', + ), + gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', + ), + interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', + ), + interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', + ), + interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', + ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}', + ), + mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', + ), + mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', + ), + mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', + ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/addressGroups/{address_group}', + ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', + ), + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', + ), + serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', + ), + tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', + ), + urlListPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/urlLists/{url_list}', + ), + }; + + // 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 = { + listSACRealms: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sacRealms', + ), + listSACAttachments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sacAttachments', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(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/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createSACRealmResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SACRealm', + ) as gax.protobuf.Type; + const createSACRealmMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteSACRealmResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteSACRealmMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const createSACAttachmentResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SACAttachment', + ) as gax.protobuf.Type; + const createSACAttachmentMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteSACAttachmentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteSACAttachmentMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createSACRealm: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSACRealmResponse.decode.bind(createSACRealmResponse), + createSACRealmMetadata.decode.bind(createSACRealmMetadata), + ), + deleteSACRealm: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSACRealmResponse.decode.bind(deleteSACRealmResponse), + deleteSACRealmMetadata.decode.bind(deleteSACRealmMetadata), + ), + createSACAttachment: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSACAttachmentResponse.decode.bind(createSACAttachmentResponse), + createSACAttachmentMetadata.decode.bind(createSACAttachmentMetadata), + ), + deleteSACAttachment: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSACAttachmentResponse.decode.bind(deleteSACAttachmentResponse), + deleteSACAttachmentMetadata.decode.bind(deleteSACAttachmentMetadata), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networksecurity.v1.SSERealmService', + 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.sSERealmServiceStub) { + return this.sSERealmServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networksecurity.v1.SSERealmService. + this.sSERealmServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.SSERealmService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1.SSERealmService, + 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 sSERealmServiceStubMethods = [ + 'listSacRealms', + 'getSacRealm', + 'createSacRealm', + 'deleteSacRealm', + 'listSacAttachments', + 'getSacAttachment', + 'createSacAttachment', + 'deleteSacAttachment', + ]; + for (const methodName of sSERealmServiceStubMethods) { + const callPromise = this.sSERealmServiceStub.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.sSERealmServiceStub; + } + + /** + * 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 'networksecurity.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 'networksecurity.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 -- + // ------------------- + /** + * Returns the specified realm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + * @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.networksecurity.v1.SACRealm|SACRealm}. + * 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/s_s_e_realm_service.get_s_a_c_realm.js + * region_tag:networksecurity_v1_generated_SSERealmService_GetSACRealm_async + */ + getSACRealm( + request?: protos.google.cloud.networksecurity.v1.IGetSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IGetSACRealmRequest | undefined, + {} | undefined, + ] + >; + getSACRealm( + request: protos.google.cloud.networksecurity.v1.IGetSACRealmRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISACRealm, + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSACRealm( + request: protos.google.cloud.networksecurity.v1.IGetSACRealmRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISACRealm, + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSACRealm( + request?: protos.google.cloud.networksecurity.v1.IGetSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networksecurity.v1.ISACRealm, + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISACRealm, + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IGetSACRealmRequest | 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().catch((err) => { + throw err; + }); + this._log.info('getSACRealm request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISACRealm, + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSACRealm response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSacRealm(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISACRealm, + ( + | protos.google.cloud.networksecurity.v1.IGetSACRealmRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSACRealm response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Returns the specified attachment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + * @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.networksecurity.v1.SACAttachment|SACAttachment}. + * 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/s_s_e_realm_service.get_s_a_c_attachment.js + * region_tag:networksecurity_v1_generated_SSERealmService_GetSACAttachment_async + */ + getSACAttachment( + request?: protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | undefined + ), + {} | undefined, + ] + >; + getSACAttachment( + request: protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISACAttachment, + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSACAttachment( + request: protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISACAttachment, + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSACAttachment( + request?: protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networksecurity.v1.ISACAttachment, + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISACAttachment, + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | 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().catch((err) => { + throw err; + }); + this._log.info('getSACAttachment request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISACAttachment, + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSACAttachment response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1.IGetSACAttachmentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSACAttachment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Creates a new SACRealm in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {string} request.sacRealmId + * Required. ID of the created realm. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + * @param {google.cloud.networksecurity.v1.SACRealm} request.sacRealm + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/s_s_e_realm_service.create_s_a_c_realm.js + * region_tag:networksecurity_v1_generated_SSERealmService_CreateSACRealm_async + */ + createSACRealm( + request?: protos.google.cloud.networksecurity.v1.ICreateSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createSACRealm( + request: protos.google.cloud.networksecurity.v1.ICreateSACRealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSACRealm( + request: protos.google.cloud.networksecurity.v1.ICreateSACRealmRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSACRealm( + request?: protos.google.cloud.networksecurity.v1.ICreateSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createSACRealm response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createSACRealm request %j', request); + return this.innerApiCalls + .createSacRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSACRealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createSACRealm()`. + * @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/s_s_e_realm_service.create_s_a_c_realm.js + * region_tag:networksecurity_v1_generated_SSERealmService_CreateSACRealm_async + */ + async checkCreateSACRealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SACRealm, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('createSACRealm long-running'); + 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.createSACRealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SACRealm, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Deletes the specified realm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/s_s_e_realm_service.delete_s_a_c_realm.js + * region_tag:networksecurity_v1_generated_SSERealmService_DeleteSACRealm_async + */ + deleteSACRealm( + request?: protos.google.cloud.networksecurity.v1.IDeleteSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteSACRealm( + request: protos.google.cloud.networksecurity.v1.IDeleteSACRealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSACRealm( + request: protos.google.cloud.networksecurity.v1.IDeleteSACRealmRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSACRealm( + request?: protos.google.cloud.networksecurity.v1.IDeleteSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteSACRealm response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteSACRealm request %j', request); + return this.innerApiCalls + .deleteSacRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSACRealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteSACRealm()`. + * @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/s_s_e_realm_service.delete_s_a_c_realm.js + * region_tag:networksecurity_v1_generated_SSERealmService_DeleteSACRealm_async + */ + async checkDeleteSACRealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('deleteSACRealm long-running'); + 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.deleteSACRealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Creates a new SACAttachment in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {string} request.sacAttachmentId + * Required. ID of the created attachment. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + * @param {google.cloud.networksecurity.v1.SACAttachment} request.sacAttachment + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/s_s_e_realm_service.create_s_a_c_attachment.js + * region_tag:networksecurity_v1_generated_SSERealmService_CreateSACAttachment_async + */ + createSACAttachment( + request?: protos.google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createSACAttachment( + request: protos.google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSACAttachment( + request: protos.google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSACAttachment( + request?: protos.google.cloud.networksecurity.v1.ICreateSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createSACAttachment response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createSACAttachment request %j', request); + return this.innerApiCalls + .createSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSACAttachment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createSACAttachment()`. + * @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/s_s_e_realm_service.create_s_a_c_attachment.js + * region_tag:networksecurity_v1_generated_SSERealmService_CreateSACAttachment_async + */ + async checkCreateSACAttachmentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SACAttachment, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('createSACAttachment long-running'); + 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.createSACAttachment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SACAttachment, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Deletes the specified attachment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/s_s_e_realm_service.delete_s_a_c_attachment.js + * region_tag:networksecurity_v1_generated_SSERealmService_DeleteSACAttachment_async + */ + deleteSACAttachment( + request?: protos.google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteSACAttachment( + request: protos.google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSACAttachment( + request: protos.google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSACAttachment( + request?: protos.google.cloud.networksecurity.v1.IDeleteSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteSACAttachment response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteSACAttachment request %j', request); + return this.innerApiCalls + .deleteSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSACAttachment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteSACAttachment()`. + * @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/s_s_e_realm_service.delete_s_a_c_attachment.js + * region_tag:networksecurity_v1_generated_SSERealmService_DeleteSACAttachment_async + */ + async checkDeleteSACAttachmentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('deleteSACAttachment long-running'); + 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.deleteSACAttachment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists SACRealms in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1.SACRealm|SACRealm}. + * 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 `listSACRealmsAsync()` + * 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. + */ + listSACRealms( + request?: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACRealm[], + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACRealmsResponse, + ] + >; + listSACRealms( + request: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACRealm + >, + ): void; + listSACRealms( + request: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACRealm + >, + ): void; + listSACRealms( + request?: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACRealm + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACRealm + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACRealm[], + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACRealmsResponse, + ] + > | 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().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACRealm + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSACRealms values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSACRealms request %j', request); + return this.innerApiCalls + .listSacRealms(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISACRealm[], + protos.google.cloud.networksecurity.v1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACRealmsResponse, + ]) => { + this._log.info('listSACRealms values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listSACRealms`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1.SACRealm|SACRealm} 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 `listSACRealmsAsync()` + * 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. + */ + listSACRealmsStream( + request?: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + 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['listSacRealms']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSACRealms stream %j', request); + return this.descriptors.page.listSACRealms.createStream( + this.innerApiCalls.listSacRealms as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listSACRealms`, 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, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@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.networksecurity.v1.SACRealm|SACRealm}. 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/s_s_e_realm_service.list_s_a_c_realms.js + * region_tag:networksecurity_v1_generated_SSERealmService_ListSACRealms_async + */ + listSACRealmsAsync( + request?: protos.google.cloud.networksecurity.v1.IListSACRealmsRequest, + 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['listSacRealms']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSACRealms iterate %j', request); + return this.descriptors.page.listSACRealms.asyncIterate( + this.innerApiCalls['listSacRealms'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists SACAttachments in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1.SACAttachment|SACAttachment}. + * 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 `listSACAttachmentsAsync()` + * 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. + */ + listSACAttachments( + request?: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACAttachment[], + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse, + ] + >; + listSACAttachments( + request: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACAttachment + >, + ): void; + listSACAttachments( + request: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACAttachment + >, + ): void; + listSACAttachments( + request?: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACAttachment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACAttachment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISACAttachment[], + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse, + ] + > | 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().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISACAttachment + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSACAttachments values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSACAttachments request %j', request); + return this.innerApiCalls + .listSacAttachments(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISACAttachment[], + protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1.IListSACAttachmentsResponse, + ]) => { + this._log.info('listSACAttachments values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listSACAttachments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1.SACAttachment|SACAttachment} 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 `listSACAttachmentsAsync()` + * 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. + */ + listSACAttachmentsStream( + request?: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + 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['listSacAttachments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSACAttachments stream %j', request); + return this.descriptors.page.listSACAttachments.createStream( + this.innerApiCalls.listSacAttachments as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listSACAttachments`, 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, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@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.networksecurity.v1.SACAttachment|SACAttachment}. 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/s_s_e_realm_service.list_s_a_c_attachments.js + * region_tag:networksecurity_v1_generated_SSERealmService_ListSACAttachments_async + */ + listSACAttachmentsAsync( + request?: protos.google.cloud.networksecurity.v1.IListSACAttachmentsRequest, + 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['listSacAttachments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSACAttachments iterate %j', request); + return this.descriptors.page.listSACAttachments.asyncIterate( + this.innerApiCalls['listSacAttachments'] 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, + optionsOrCallback?: + | 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]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + 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 { + 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 ?? '', + }); + 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, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + 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, + optionsOrCallback?: + | 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 { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified authorizationPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} authorization_policy + * @returns {string} Resource name string. + */ + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.render({ + project: project, + location: location, + authorization_policy: authorizationPolicy, + }); + } + + /** + * Parse the project from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; + } + + /** + * Parse the location from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; + } + + /** + * Parse the authorization_policy from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the authorization_policy. + */ + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; + } + + /** + * Return a fully-qualified authzPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} authz_policy + * @returns {string} Resource name string. + */ + authzPolicyPath(project: string, location: string, authzPolicy: string) { + return this.pathTemplates.authzPolicyPathTemplate.render({ + project: project, + location: location, + authz_policy: authzPolicy, + }); + } + + /** + * Parse the project from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; + } + + /** + * Parse the location from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; + } + + /** + * Parse the authz_policy from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the authz_policy. + */ + matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; + } + + /** + * Return a fully-qualified backendAuthenticationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backend_authentication_config + * @returns {string} Resource name string. + */ + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ + project: project, + location: location, + backend_authentication_config: backendAuthenticationConfig, + }); + } + + /** + * Parse the project from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; + } + + /** + * Parse the location from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; + } + + /** + * Parse the backend_authentication_config from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the backend_authentication_config. + */ + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; + } + + /** + * Return a fully-qualified clientTlsPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} client_tls_policy + * @returns {string} Resource name string. + */ + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { + return this.pathTemplates.clientTlsPolicyPathTemplate.render({ + project: project, + location: location, + client_tls_policy: clientTlsPolicy, + }); + } + + /** + * Parse the project from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; + } + + /** + * Parse the location from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; + } + + /** + * Parse the client_tls_policy from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the client_tls_policy. + */ + matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; + } + + /** + * Return a fully-qualified dnsThreatDetector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} dns_threat_detector + * @returns {string} Resource name string. + */ + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ + project: project, + location: location, + dns_threat_detector: dnsThreatDetector, + }); + } + + /** + * Parse the project from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; + } + + /** + * Parse the location from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; + } + + /** + * Parse the dns_threat_detector from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the dns_threat_detector. + */ + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; + } + + /** + * Return a fully-qualified firewallEndpointAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} firewall_endpoint_association + * @returns {string} Resource name string. + */ + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ + project: project, + location: location, + firewall_endpoint_association: firewallEndpointAssociation, + }); + } + + /** + * Parse the project from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; + } + + /** + * Parse the location from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; + } + + /** + * Parse the firewall_endpoint_association from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the firewall_endpoint_association. + */ + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; + } + + /** + * Return a fully-qualified gatewaySecurityPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} gateway_security_policy + * @returns {string} Resource name string. + */ + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ + project: project, + location: location, + gateway_security_policy: gatewaySecurityPolicy, + }); + } + + /** + * Parse the project from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; + } + + /** + * Parse the location from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; + } + + /** + * Parse the gateway_security_policy from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the gateway_security_policy. + */ + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; + } + + /** + * Return a fully-qualified gatewaySecurityPolicyRule resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} gateway_security_policy + * @param {string} rule + * @returns {string} Resource name string. + */ + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ + project: project, + location: location, + gateway_security_policy: gatewaySecurityPolicy, + rule: rule, + }); + } + + /** + * Parse the project from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; + } + + /** + * Parse the location from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; + } + + /** + * Parse the gateway_security_policy from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the gateway_security_policy. + */ + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; + } + + /** + * Parse the rule from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the rule. + */ + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; + } + + /** + * Return a fully-qualified interceptDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_deployment + * @returns {string} Resource name string. + */ + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.render({ + project: project, + location: location, + intercept_deployment: interceptDeployment, + }); + } + + /** + * Parse the project from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; + } + + /** + * Parse the location from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; + } + + /** + * Parse the intercept_deployment from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the intercept_deployment. + */ + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; + } + + /** + * Return a fully-qualified interceptDeploymentGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_deployment_group + * @returns {string} Resource name string. + */ + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ + project: project, + location: location, + intercept_deployment_group: interceptDeploymentGroup, + }); + } + + /** + * Parse the project from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; + } + + /** + * Parse the location from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; + } + + /** + * Parse the intercept_deployment_group from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the intercept_deployment_group. + */ + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; + } + + /** + * Return a fully-qualified interceptEndpointGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_endpoint_group + * @returns {string} Resource name string. + */ + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ + project: project, + location: location, + intercept_endpoint_group: interceptEndpointGroup, + }); + } + + /** + * Parse the project from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; + } + + /** + * Parse the location from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; + } + + /** + * Parse the intercept_endpoint_group from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the intercept_endpoint_group. + */ + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; + } + + /** + * Return a fully-qualified interceptEndpointGroupAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_endpoint_group_association + * @returns {string} Resource name string. + */ + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); + } + + /** + * Parse the project from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; + } + + /** + * Parse the location from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; + } + + /** + * Parse the intercept_endpoint_group_association from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the intercept_endpoint_group_association. + */ + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; + } + + /** + * 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 mirroringDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_deployment + * @returns {string} Resource name string. + */ + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.render({ + project: project, + location: location, + mirroring_deployment: mirroringDeployment, + }); + } + + /** + * Parse the project from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; + } + + /** + * Parse the location from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; + } + + /** + * Parse the mirroring_deployment from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the mirroring_deployment. + */ + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; + } + + /** + * Return a fully-qualified mirroringDeploymentGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_deployment_group + * @returns {string} Resource name string. + */ + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ + project: project, + location: location, + mirroring_deployment_group: mirroringDeploymentGroup, + }); + } + + /** + * Parse the project from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; + } + + /** + * Parse the location from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; + } + + /** + * Parse the mirroring_deployment_group from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the mirroring_deployment_group. + */ + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; + } + + /** + * Return a fully-qualified mirroringEndpointGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_endpoint_group + * @returns {string} Resource name string. + */ + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ + project: project, + location: location, + mirroring_endpoint_group: mirroringEndpointGroup, + }); + } + + /** + * Parse the project from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; + } + + /** + * Parse the location from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; + } + + /** + * Parse the mirroring_endpoint_group from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the mirroring_endpoint_group. + */ + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; + } + + /** + * Return a fully-qualified mirroringEndpointGroupAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_endpoint_group_association + * @returns {string} Resource name string. + */ + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); + } + + /** + * Parse the project from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; + } + + /** + * Parse the location from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; + } + + /** + * Parse the mirroring_endpoint_group_association from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the mirroring_endpoint_group_association. + */ + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; + } + + /** + * Return a fully-qualified organizationLocationAddressGroup resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} address_group + * @returns {string} Resource name string. + */ + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; + } + + /** + * Parse the address_group from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the address_group. + */ + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; + } + + /** + * Return a fully-qualified organizationLocationFirewallEndpoints resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} firewall_endpoint + * @returns {string} Resource name string. + */ + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; + } + + /** + * Parse the firewall_endpoint from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the firewall_endpoint. + */ + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; + } + + /** + * Return a fully-qualified organizationLocationSecurityProfile resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} security_profile + * @returns {string} Resource name string. + */ + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; + } + + /** + * Parse the security_profile from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the security_profile. + */ + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; + } + + /** + * Return a fully-qualified organizationLocationSecurityProfileGroup resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} security_profile_group + * @returns {string} Resource name string. + */ + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; + } + + /** + * Parse the security_profile_group from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the security_profile_group. + */ + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * 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 projectLocationAddressGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} address_group + * @returns {string} Resource name string. + */ + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ + project: project, + location: location, + address_group: addressGroup, + }); + } + + /** + * Parse the project from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; + } + + /** + * Parse the location from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; + } + + /** + * Parse the address_group from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the address_group. + */ + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; + } + + /** + * Return a fully-qualified projectLocationFirewallEndpoints resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} firewall_endpoint + * @returns {string} Resource name string. + */ + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); + } + + /** + * Parse the project from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; + } + + /** + * Parse the location from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; + } + + /** + * Parse the firewall_endpoint from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the firewall_endpoint. + */ + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; + } + + /** + * Return a fully-qualified projectLocationSecurityProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_profile + * @returns {string} Resource name string. + */ + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); + } + + /** + * Parse the project from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; + } + + /** + * Parse the location from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; + } + + /** + * Parse the security_profile from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the security_profile. + */ + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; + } + + /** + * Return a fully-qualified projectLocationSecurityProfileGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_profile_group + * @returns {string} Resource name string. + */ + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); + } + + /** + * Parse the project from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; + } + + /** + * Parse the location from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; + } + + /** + * Parse the security_profile_group from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the security_profile_group. + */ + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; + } + + /** + * Return a fully-qualified serverTlsPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} server_tls_policy + * @returns {string} Resource name string. + */ + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { + return this.pathTemplates.serverTlsPolicyPathTemplate.render({ + project: project, + location: location, + server_tls_policy: serverTlsPolicy, + }); + } + + /** + * Parse the project from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; + } + + /** + * Parse the location from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; + } + + /** + * Parse the server_tls_policy from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the server_tls_policy. + */ + matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; + } + + /** + * Return a fully-qualified tlsInspectionPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} tls_inspection_policy + * @returns {string} Resource name string. + */ + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ + project: project, + location: location, + tls_inspection_policy: tlsInspectionPolicy, + }); + } + + /** + * Parse the project from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; + } + + /** + * Parse the location from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; + } + + /** + * Parse the tls_inspection_policy from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the tls_inspection_policy. + */ + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; + } + + /** + * Return a fully-qualified urlList resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} url_list + * @returns {string} Resource name string. + */ + urlListPath(project: string, location: string, urlList: string) { + return this.pathTemplates.urlListPathTemplate.render({ + project: project, + location: location, + url_list: urlList, + }); + } + + /** + * Parse the project from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the project. + */ + matchProjectFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).project; + } + + /** + * Parse the location from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the location. + */ + matchLocationFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).location; + } + + /** + * Parse the url_list from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the url_list. + */ + matchUrlListFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).url_list; + } + + /** + * 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.sSERealmServiceStub && !this._terminated) { + return this.sSERealmServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client_config.json b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client_config.json new file mode 100644 index 000000000000..cc94f21aa732 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.networksecurity.v1.SSERealmService": { + "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": { + "ListSACRealms": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSACRealm": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSACRealm": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSACRealm": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSACAttachments": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSACAttachment": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSACAttachment": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSACAttachment": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_proto_list.json new file mode 100644 index 000000000000..2138f74b5c58 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/s_s_e_realm_service_proto_list.json @@ -0,0 +1,26 @@ +[ + "../../protos/google/cloud/networksecurity/v1/address_group.proto", + "../../protos/google/cloud/networksecurity/v1/authorization_policy.proto", + "../../protos/google/cloud/networksecurity/v1/authz_policy.proto", + "../../protos/google/cloud/networksecurity/v1/backend_authentication_config.proto", + "../../protos/google/cloud/networksecurity/v1/client_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/common.proto", + "../../protos/google/cloud/networksecurity/v1/dns_threat_detector.proto", + "../../protos/google/cloud/networksecurity/v1/firewall_activation.proto", + "../../protos/google/cloud/networksecurity/v1/gateway_security_policy.proto", + "../../protos/google/cloud/networksecurity/v1/gateway_security_policy_rule.proto", + "../../protos/google/cloud/networksecurity/v1/intercept.proto", + "../../protos/google/cloud/networksecurity/v1/mirroring.proto", + "../../protos/google/cloud/networksecurity/v1/network_security.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_intercept.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_mirroring.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_service.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", + "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", + "../../protos/google/cloud/networksecurity/v1/tls.proto", + "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", + "../../protos/google/cloud/networksecurity/v1/url_list.proto" +] diff --git a/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client.ts b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client.ts new file mode 100644 index 000000000000..04de9fa215b5 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client.ts @@ -0,0 +1,4913 @@ +// Copyright 2026 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'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/security_profile_group_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_profile_group_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * SecurityProfileGroup is a resource that defines an action for specific threat + * signatures or severity levels. + * @class + * @memberof v1 + */ +export class SecurityProfileGroupServiceClient { + 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; + private _log = logging.log('network-security'); + + 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; + securityProfileGroupServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SecurityProfileGroupServiceClient. + * + * @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://cloud.google.com/docs/authentication/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 SecurityProfileGroupServiceClient({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 SecurityProfileGroupServiceClient; + 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 = 'networksecurity.' + 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 = { + authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', + ), + authzPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', + ), + backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', + ), + clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', + ), + dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', + ), + firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', + ), + gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', + ), + gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', + ), + interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', + ), + interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', + ), + interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', + ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), + mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', + ), + mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', + ), + mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', + ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}', + ), + organizationLocationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}', + ), + organizationLocationAddressGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/addressGroups/{address_group}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + projectLocationAddressGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/addressGroups/{address_group}', + ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), + sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', + ), + sACRealmPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', + ), + serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', + ), + tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', + ), + urlListPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/urlLists/{url_list}', + ), + }; + + // 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 = { + listSecurityProfileGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfileGroups', + ), + listSecurityProfiles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfiles', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(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/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}' }, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + { get: '/v1/{name=organizations/*}/locations' }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=organizations/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { delete: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createSecurityProfileGroupResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SecurityProfileGroup', + ) as gax.protobuf.Type; + const createSecurityProfileGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateSecurityProfileGroupResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SecurityProfileGroup', + ) as gax.protobuf.Type; + const updateSecurityProfileGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteSecurityProfileGroupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteSecurityProfileGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const createSecurityProfileResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SecurityProfile', + ) as gax.protobuf.Type; + const createSecurityProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateSecurityProfileResponse = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.SecurityProfile', + ) as gax.protobuf.Type; + const updateSecurityProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteSecurityProfileResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteSecurityProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1.OperationMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSecurityProfileGroupResponse.decode.bind( + createSecurityProfileGroupResponse, + ), + createSecurityProfileGroupMetadata.decode.bind( + createSecurityProfileGroupMetadata, + ), + ), + updateSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSecurityProfileGroupResponse.decode.bind( + updateSecurityProfileGroupResponse, + ), + updateSecurityProfileGroupMetadata.decode.bind( + updateSecurityProfileGroupMetadata, + ), + ), + deleteSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSecurityProfileGroupResponse.decode.bind( + deleteSecurityProfileGroupResponse, + ), + deleteSecurityProfileGroupMetadata.decode.bind( + deleteSecurityProfileGroupMetadata, + ), + ), + createSecurityProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSecurityProfileResponse.decode.bind( + createSecurityProfileResponse, + ), + createSecurityProfileMetadata.decode.bind( + createSecurityProfileMetadata, + ), + ), + updateSecurityProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSecurityProfileResponse.decode.bind( + updateSecurityProfileResponse, + ), + updateSecurityProfileMetadata.decode.bind( + updateSecurityProfileMetadata, + ), + ), + deleteSecurityProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSecurityProfileResponse.decode.bind( + deleteSecurityProfileResponse, + ), + deleteSecurityProfileMetadata.decode.bind( + deleteSecurityProfileMetadata, + ), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networksecurity.v1.SecurityProfileGroupService', + 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.securityProfileGroupServiceStub) { + return this.securityProfileGroupServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networksecurity.v1.SecurityProfileGroupService. + this.securityProfileGroupServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1.SecurityProfileGroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1 + .SecurityProfileGroupService, + 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 securityProfileGroupServiceStubMethods = [ + 'listSecurityProfileGroups', + 'getSecurityProfileGroup', + 'createSecurityProfileGroup', + 'updateSecurityProfileGroup', + 'deleteSecurityProfileGroup', + 'listSecurityProfiles', + 'getSecurityProfile', + 'createSecurityProfile', + 'updateSecurityProfile', + 'deleteSecurityProfile', + ]; + for (const methodName of securityProfileGroupServiceStubMethods) { + const callPromise = this.securityProfileGroupServiceStub.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.securityProfileGroupServiceStub; + } + + /** + * 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 'networksecurity.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 'networksecurity.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 details of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. + * 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/security_profile_group_service.get_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfileGroup_async + */ + getSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ] + >; + getSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | 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().catch((err) => { + throw err; + }); + this._log.info('getSecurityProfileGroup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSecurityProfileGroup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfileGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Gets details of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. + * 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/security_profile_group_service.get_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_GetSecurityProfile_async + */ + getSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ] + >; + getSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | 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().catch((err) => { + throw err; + }); + this._log.info('getSecurityProfile request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getSecurityProfile response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfile response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Creates a new SecurityProfileGroup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfileGroup. Must be in the + * format `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileGroupId + * Required. Short name of the SecurityProfileGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "security_profile_group1". + * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup + * Required. SecurityProfileGroup resource to be created. + * @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/security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfileGroup_async + */ + createSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createSecurityProfileGroup response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createSecurityProfileGroup request %j', request); + return this.innerApiCalls + .createSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createSecurityProfileGroup()`. + * @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/security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfileGroup_async + */ + async checkCreateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('createSecurityProfileGroup long-running'); + 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.createSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Updates the parameters of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfileGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1.SecurityProfileGroup} request.securityProfileGroup + * Required. Updated SecurityProfileGroup 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/security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ + updateSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.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({ + 'security_profile_group.name': request.securityProfileGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateSecurityProfileGroup response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateSecurityProfileGroup request %j', request); + return this.innerApiCalls + .updateSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateSecurityProfileGroup()`. + * @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/security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ + async checkUpdateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('updateSecurityProfileGroup long-running'); + 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.updateSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Deletes a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to delete. Must be in the + * format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ + deleteSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSecurityProfileGroup( + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSecurityProfileGroup( + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteSecurityProfileGroup response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteSecurityProfileGroup request %j', request); + return this.innerApiCalls + .deleteSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteSecurityProfileGroup()`. + * @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/security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ + async checkDeleteSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('deleteSecurityProfileGroup long-running'); + 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.deleteSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Creates a new SecurityProfile in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfile. Must be in the format + * `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileId + * Required. Short name of the SecurityProfile resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "security_profile1". + * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile + * Required. SecurityProfile resource to be created. + * @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/security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfile_async + */ + createSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createSecurityProfile( + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSecurityProfile( + request: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.ICreateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createSecurityProfile response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createSecurityProfile request %j', request); + return this.innerApiCalls + .createSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createSecurityProfile()`. + * @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/security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_CreateSecurityProfile_async + */ + async checkCreateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('createSecurityProfile long-running'); + 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.createSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Updates the parameters of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1.SecurityProfile} request.securityProfile + * Required. Updated SecurityProfile 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/security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfile_async + */ + updateSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IUpdateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.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({ + 'security_profile.name': request.securityProfile!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateSecurityProfile response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateSecurityProfile request %j', request); + return this.innerApiCalls + .updateSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateSecurityProfile()`. + * @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/security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_UpdateSecurityProfile_async + */ + async checkUpdateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('updateSecurityProfile long-running'); + 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.updateSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1.SecurityProfile, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Deletes a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to delete. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfile_async + */ + deleteSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSecurityProfile( + request: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSecurityProfile( + request?: protos.google.cloud.networksecurity.v1.IDeleteSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.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().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteSecurityProfile response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteSecurityProfile request %j', request); + return this.innerApiCalls + .deleteSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteSecurityProfile()`. + * @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/security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_DeleteSecurityProfile_async + */ + async checkDeleteSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + > + > { + this._log.info('deleteSecurityProfile long-running'); + 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.deleteSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1.OperationMetadata + >; + } + /** + * Lists SecurityProfileGroups in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. + * 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 `listSecurityProfileGroupsAsync()` + * 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. + */ + listSecurityProfileGroups( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ] + >; + listSecurityProfileGroups( + request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): void; + listSecurityProfileGroups( + request: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): void; + listSecurityProfileGroups( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ] + > | 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().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSecurityProfileGroups values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSecurityProfileGroups request %j', request); + return this.innerApiCalls + .listSecurityProfileGroups(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsResponse, + ]) => { + this._log.info('listSecurityProfileGroups values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listSecurityProfileGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup} 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 `listSecurityProfileGroupsAsync()` + * 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. + */ + listSecurityProfileGroupsStream( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + 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['listSecurityProfileGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSecurityProfileGroups stream %j', request); + return this.descriptors.page.listSecurityProfileGroups.createStream( + this.innerApiCalls.listSecurityProfileGroups as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listSecurityProfileGroups`, 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 project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfileGroups to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1.SecurityProfileGroup|SecurityProfileGroup}. 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/security_profile_group_service.list_security_profile_groups.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfileGroups_async + */ + listSecurityProfileGroupsAsync( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfileGroupsRequest, + 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['listSecurityProfileGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSecurityProfileGroups iterate %j', request); + return this.descriptors.page.listSecurityProfileGroups.asyncIterate( + this.innerApiCalls['listSecurityProfileGroups'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists SecurityProfiles in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. + * 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 `listSecurityProfilesAsync()` + * 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. + */ + listSecurityProfiles( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ] + >; + listSecurityProfiles( + request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): void; + listSecurityProfiles( + request: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): void; + listSecurityProfiles( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ] + > | 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().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1.ISecurityProfile + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSecurityProfiles values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSecurityProfiles request %j', request); + return this.innerApiCalls + .listSecurityProfiles(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1.IListSecurityProfilesResponse, + ]) => { + this._log.info('listSecurityProfiles values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listSecurityProfiles`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile} 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 `listSecurityProfilesAsync()` + * 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. + */ + listSecurityProfilesStream( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + 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['listSecurityProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSecurityProfiles stream %j', request); + return this.descriptors.page.listSecurityProfiles.createStream( + this.innerApiCalls.listSecurityProfiles as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listSecurityProfiles`, 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 project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Maximum number of SecurityProfiles to return per call. + * @param {string} [request.pageToken] + * Optional. The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1.SecurityProfile|SecurityProfile}. 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/security_profile_group_service.list_security_profiles.js + * region_tag:networksecurity_v1_generated_SecurityProfileGroupService_ListSecurityProfiles_async + */ + listSecurityProfilesAsync( + request?: protos.google.cloud.networksecurity.v1.IListSecurityProfilesRequest, + 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['listSecurityProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSecurityProfiles iterate %j', request); + return this.descriptors.page.listSecurityProfiles.asyncIterate( + this.innerApiCalls['listSecurityProfiles'] 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, + optionsOrCallback?: + | 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]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + 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 { + 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 ?? '', + }); + 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, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + 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, + optionsOrCallback?: + | 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 { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified authorizationPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} authorization_policy + * @returns {string} Resource name string. + */ + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.render({ + project: project, + location: location, + authorization_policy: authorizationPolicy, + }); + } + + /** + * Parse the project from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; + } + + /** + * Parse the location from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; + } + + /** + * Parse the authorization_policy from AuthorizationPolicy resource. + * + * @param {string} authorizationPolicyName + * A fully-qualified path representing AuthorizationPolicy resource. + * @returns {string} A string representing the authorization_policy. + */ + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; + } + + /** + * Return a fully-qualified authzPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} authz_policy + * @returns {string} Resource name string. + */ + authzPolicyPath(project: string, location: string, authzPolicy: string) { + return this.pathTemplates.authzPolicyPathTemplate.render({ + project: project, + location: location, + authz_policy: authzPolicy, + }); + } + + /** + * Parse the project from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; + } + + /** + * Parse the location from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; + } + + /** + * Parse the authz_policy from AuthzPolicy resource. + * + * @param {string} authzPolicyName + * A fully-qualified path representing AuthzPolicy resource. + * @returns {string} A string representing the authz_policy. + */ + matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; + } + + /** + * Return a fully-qualified backendAuthenticationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backend_authentication_config + * @returns {string} Resource name string. + */ + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ + project: project, + location: location, + backend_authentication_config: backendAuthenticationConfig, + }); + } + + /** + * Parse the project from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; + } + + /** + * Parse the location from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; + } + + /** + * Parse the backend_authentication_config from BackendAuthenticationConfig resource. + * + * @param {string} backendAuthenticationConfigName + * A fully-qualified path representing BackendAuthenticationConfig resource. + * @returns {string} A string representing the backend_authentication_config. + */ + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; + } + + /** + * Return a fully-qualified clientTlsPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} client_tls_policy + * @returns {string} Resource name string. + */ + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { + return this.pathTemplates.clientTlsPolicyPathTemplate.render({ + project: project, + location: location, + client_tls_policy: clientTlsPolicy, + }); + } + + /** + * Parse the project from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; + } + + /** + * Parse the location from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; + } + + /** + * Parse the client_tls_policy from ClientTlsPolicy resource. + * + * @param {string} clientTlsPolicyName + * A fully-qualified path representing ClientTlsPolicy resource. + * @returns {string} A string representing the client_tls_policy. + */ + matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; + } + + /** + * Return a fully-qualified dnsThreatDetector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} dns_threat_detector + * @returns {string} Resource name string. + */ + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ + project: project, + location: location, + dns_threat_detector: dnsThreatDetector, + }); + } + + /** + * Parse the project from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; + } + + /** + * Parse the location from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; + } + + /** + * Parse the dns_threat_detector from DnsThreatDetector resource. + * + * @param {string} dnsThreatDetectorName + * A fully-qualified path representing DnsThreatDetector resource. + * @returns {string} A string representing the dns_threat_detector. + */ + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; + } + + /** + * Return a fully-qualified firewallEndpointAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} firewall_endpoint_association + * @returns {string} Resource name string. + */ + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ + project: project, + location: location, + firewall_endpoint_association: firewallEndpointAssociation, + }); + } + + /** + * Parse the project from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; + } + + /** + * Parse the location from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; + } + + /** + * Parse the firewall_endpoint_association from FirewallEndpointAssociation resource. + * + * @param {string} firewallEndpointAssociationName + * A fully-qualified path representing FirewallEndpointAssociation resource. + * @returns {string} A string representing the firewall_endpoint_association. + */ + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; + } + + /** + * Return a fully-qualified gatewaySecurityPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} gateway_security_policy + * @returns {string} Resource name string. + */ + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ + project: project, + location: location, + gateway_security_policy: gatewaySecurityPolicy, + }); + } + + /** + * Parse the project from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; + } + + /** + * Parse the location from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; + } + + /** + * Parse the gateway_security_policy from GatewaySecurityPolicy resource. + * + * @param {string} gatewaySecurityPolicyName + * A fully-qualified path representing GatewaySecurityPolicy resource. + * @returns {string} A string representing the gateway_security_policy. + */ + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; + } + + /** + * Return a fully-qualified gatewaySecurityPolicyRule resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} gateway_security_policy + * @param {string} rule + * @returns {string} Resource name string. + */ + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ + project: project, + location: location, + gateway_security_policy: gatewaySecurityPolicy, + rule: rule, + }); + } + + /** + * Parse the project from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; + } + + /** + * Parse the location from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; + } + + /** + * Parse the gateway_security_policy from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the gateway_security_policy. + */ + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; + } + + /** + * Parse the rule from GatewaySecurityPolicyRule resource. + * + * @param {string} gatewaySecurityPolicyRuleName + * A fully-qualified path representing GatewaySecurityPolicyRule resource. + * @returns {string} A string representing the rule. + */ + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; + } + + /** + * Return a fully-qualified interceptDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_deployment + * @returns {string} Resource name string. + */ + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.render({ + project: project, + location: location, + intercept_deployment: interceptDeployment, + }); + } + + /** + * Parse the project from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; + } + + /** + * Parse the location from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; + } + + /** + * Parse the intercept_deployment from InterceptDeployment resource. + * + * @param {string} interceptDeploymentName + * A fully-qualified path representing InterceptDeployment resource. + * @returns {string} A string representing the intercept_deployment. + */ + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; + } + + /** + * Return a fully-qualified interceptDeploymentGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_deployment_group + * @returns {string} Resource name string. + */ + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ + project: project, + location: location, + intercept_deployment_group: interceptDeploymentGroup, + }); + } + + /** + * Parse the project from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; + } + + /** + * Parse the location from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; + } + + /** + * Parse the intercept_deployment_group from InterceptDeploymentGroup resource. + * + * @param {string} interceptDeploymentGroupName + * A fully-qualified path representing InterceptDeploymentGroup resource. + * @returns {string} A string representing the intercept_deployment_group. + */ + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; + } + + /** + * Return a fully-qualified interceptEndpointGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_endpoint_group + * @returns {string} Resource name string. + */ + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ + project: project, + location: location, + intercept_endpoint_group: interceptEndpointGroup, + }); + } + + /** + * Parse the project from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; + } + + /** + * Parse the location from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; + } + + /** + * Parse the intercept_endpoint_group from InterceptEndpointGroup resource. + * + * @param {string} interceptEndpointGroupName + * A fully-qualified path representing InterceptEndpointGroup resource. + * @returns {string} A string representing the intercept_endpoint_group. + */ + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; + } + + /** + * Return a fully-qualified interceptEndpointGroupAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intercept_endpoint_group_association + * @returns {string} Resource name string. + */ + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); + } + + /** + * Parse the project from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; + } + + /** + * Parse the location from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; + } + + /** + * Parse the intercept_endpoint_group_association from InterceptEndpointGroupAssociation resource. + * + * @param {string} interceptEndpointGroupAssociationName + * A fully-qualified path representing InterceptEndpointGroupAssociation resource. + * @returns {string} A string representing the intercept_endpoint_group_association. + */ + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; + } + + /** + * Return a fully-qualified mirroringDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_deployment + * @returns {string} Resource name string. + */ + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.render({ + project: project, + location: location, + mirroring_deployment: mirroringDeployment, + }); + } + + /** + * Parse the project from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; + } + + /** + * Parse the location from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; + } + + /** + * Parse the mirroring_deployment from MirroringDeployment resource. + * + * @param {string} mirroringDeploymentName + * A fully-qualified path representing MirroringDeployment resource. + * @returns {string} A string representing the mirroring_deployment. + */ + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; + } + + /** + * Return a fully-qualified mirroringDeploymentGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_deployment_group + * @returns {string} Resource name string. + */ + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ + project: project, + location: location, + mirroring_deployment_group: mirroringDeploymentGroup, + }); + } + + /** + * Parse the project from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; + } + + /** + * Parse the location from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; + } + + /** + * Parse the mirroring_deployment_group from MirroringDeploymentGroup resource. + * + * @param {string} mirroringDeploymentGroupName + * A fully-qualified path representing MirroringDeploymentGroup resource. + * @returns {string} A string representing the mirroring_deployment_group. + */ + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; + } + + /** + * Return a fully-qualified mirroringEndpointGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_endpoint_group + * @returns {string} Resource name string. + */ + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ + project: project, + location: location, + mirroring_endpoint_group: mirroringEndpointGroup, + }); + } + + /** + * Parse the project from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; + } + + /** + * Parse the location from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; + } + + /** + * Parse the mirroring_endpoint_group from MirroringEndpointGroup resource. + * + * @param {string} mirroringEndpointGroupName + * A fully-qualified path representing MirroringEndpointGroup resource. + * @returns {string} A string representing the mirroring_endpoint_group. + */ + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; + } + + /** + * Return a fully-qualified mirroringEndpointGroupAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mirroring_endpoint_group_association + * @returns {string} Resource name string. + */ + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); + } + + /** + * Parse the project from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; + } + + /** + * Parse the location from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; + } + + /** + * Parse the mirroring_endpoint_group_association from MirroringEndpointGroupAssociation resource. + * + * @param {string} mirroringEndpointGroupAssociationName + * A fully-qualified path representing MirroringEndpointGroupAssociation resource. + * @returns {string} A string representing the mirroring_endpoint_group_association. + */ + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization: string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; + } + + /** + * Return a fully-qualified organizationLocation resource name string. + * + * @param {string} organization + * @param {string} location + * @returns {string} Resource name string. + */ + organizationLocationPath(organization: string, location: string) { + return this.pathTemplates.organizationLocationPathTemplate.render({ + organization: organization, + location: location, + }); + } + + /** + * Parse the organization from OrganizationLocation resource. + * + * @param {string} organizationLocationName + * A fully-qualified path representing OrganizationLocation resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationName( + organizationLocationName: string, + ) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).organization; + } + + /** + * Parse the location from OrganizationLocation resource. + * + * @param {string} organizationLocationName + * A fully-qualified path representing OrganizationLocation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationName(organizationLocationName: string) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).location; + } + + /** + * Return a fully-qualified organizationLocationAddressGroup resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} address_group + * @returns {string} Resource name string. + */ + organizationLocationAddressGroupPath( + organization: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.render( + { + organization: organization, + location: location, + address_group: addressGroup, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).location; + } + + /** + * Parse the address_group from OrganizationLocationAddressGroup resource. + * + * @param {string} organizationLocationAddressGroupName + * A fully-qualified path representing organization_location_address_group resource. + * @returns {string} A string representing the address_group. + */ + matchAddressGroupFromOrganizationLocationAddressGroupName( + organizationLocationAddressGroupName: string, + ) { + return this.pathTemplates.organizationLocationAddressGroupPathTemplate.match( + organizationLocationAddressGroupName, + ).address_group; + } + + /** + * Return a fully-qualified organizationLocationFirewallEndpoints resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} firewall_endpoint + * @returns {string} Resource name string. + */ + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; + } + + /** + * Parse the firewall_endpoint from OrganizationLocationFirewallEndpoints resource. + * + * @param {string} organizationLocationFirewallEndpointsName + * A fully-qualified path representing organization_location_firewallEndpoints resource. + * @returns {string} A string representing the firewall_endpoint. + */ + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; + } + + /** + * Return a fully-qualified organizationLocationSecurityProfile resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} security_profile + * @returns {string} Resource name string. + */ + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; + } + + /** + * Parse the security_profile from OrganizationLocationSecurityProfile resource. + * + * @param {string} organizationLocationSecurityProfileName + * A fully-qualified path representing organization_location_security_profile resource. + * @returns {string} A string representing the security_profile. + */ + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; + } + + /** + * Return a fully-qualified organizationLocationSecurityProfileGroup resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} security_profile_group + * @returns {string} Resource name string. + */ + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); + } + + /** + * Parse the organization from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; + } + + /** + * Parse the location from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; + } + + /** + * Parse the security_profile_group from OrganizationLocationSecurityProfileGroup resource. + * + * @param {string} organizationLocationSecurityProfileGroupName + * A fully-qualified path representing organization_location_security_profile_group resource. + * @returns {string} A string representing the security_profile_group. + */ + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified projectLocationAddressGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} address_group + * @returns {string} Resource name string. + */ + projectLocationAddressGroupPath( + project: string, + location: string, + addressGroup: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.render({ + project: project, + location: location, + address_group: addressGroup, + }); + } + + /** + * Parse the project from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).project; + } + + /** + * Parse the location from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).location; + } + + /** + * Parse the address_group from ProjectLocationAddressGroup resource. + * + * @param {string} projectLocationAddressGroupName + * A fully-qualified path representing project_location_address_group resource. + * @returns {string} A string representing the address_group. + */ + matchAddressGroupFromProjectLocationAddressGroupName( + projectLocationAddressGroupName: string, + ) { + return this.pathTemplates.projectLocationAddressGroupPathTemplate.match( + projectLocationAddressGroupName, + ).address_group; + } + + /** + * Return a fully-qualified projectLocationFirewallEndpoints resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} firewall_endpoint + * @returns {string} Resource name string. + */ + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); + } + + /** + * Parse the project from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; + } + + /** + * Parse the location from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; + } + + /** + * Parse the firewall_endpoint from ProjectLocationFirewallEndpoints resource. + * + * @param {string} projectLocationFirewallEndpointsName + * A fully-qualified path representing project_location_firewallEndpoints resource. + * @returns {string} A string representing the firewall_endpoint. + */ + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; + } + + /** + * Return a fully-qualified projectLocationSecurityProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_profile + * @returns {string} Resource name string. + */ + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); + } + + /** + * Parse the project from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; + } + + /** + * Parse the location from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; + } + + /** + * Parse the security_profile from ProjectLocationSecurityProfile resource. + * + * @param {string} projectLocationSecurityProfileName + * A fully-qualified path representing project_location_security_profile resource. + * @returns {string} A string representing the security_profile. + */ + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; + } + + /** + * Return a fully-qualified projectLocationSecurityProfileGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_profile_group + * @returns {string} Resource name string. + */ + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); + } + + /** + * Parse the project from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; + } + + /** + * Parse the location from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; + } + + /** + * Parse the security_profile_group from ProjectLocationSecurityProfileGroup resource. + * + * @param {string} projectLocationSecurityProfileGroupName + * A fully-qualified path representing project_location_security_profile_group resource. + * @returns {string} A string representing the security_profile_group. + */ + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; + } + + /** + * Return a fully-qualified sACAttachment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_attachment + * @returns {string} Resource name string. + */ + sACAttachmentPath(project: string, location: string, sacAttachment: string) { + return this.pathTemplates.sACAttachmentPathTemplate.render({ + project: project, + location: location, + sac_attachment: sacAttachment, + }); + } + + /** + * Parse the project from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; + } + + /** + * Parse the location from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; + } + + /** + * Parse the sac_attachment from SACAttachment resource. + * + * @param {string} sACAttachmentName + * A fully-qualified path representing SACAttachment resource. + * @returns {string} A string representing the sac_attachment. + */ + matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; + } + + /** + * Return a fully-qualified sACRealm resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} sac_realm + * @returns {string} Resource name string. + */ + sACRealmPath(project: string, location: string, sacRealm: string) { + return this.pathTemplates.sACRealmPathTemplate.render({ + project: project, + location: location, + sac_realm: sacRealm, + }); + } + + /** + * Parse the project from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).project; + } + + /** + * Parse the location from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).location; + } + + /** + * Parse the sac_realm from SACRealm resource. + * + * @param {string} sACRealmName + * A fully-qualified path representing SACRealm resource. + * @returns {string} A string representing the sac_realm. + */ + matchSacRealmFromSACRealmName(sACRealmName: string) { + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; + } + + /** + * Return a fully-qualified serverTlsPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} server_tls_policy + * @returns {string} Resource name string. + */ + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { + return this.pathTemplates.serverTlsPolicyPathTemplate.render({ + project: project, + location: location, + server_tls_policy: serverTlsPolicy, + }); + } + + /** + * Parse the project from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; + } + + /** + * Parse the location from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; + } + + /** + * Parse the server_tls_policy from ServerTlsPolicy resource. + * + * @param {string} serverTlsPolicyName + * A fully-qualified path representing ServerTlsPolicy resource. + * @returns {string} A string representing the server_tls_policy. + */ + matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; + } + + /** + * Return a fully-qualified tlsInspectionPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} tls_inspection_policy + * @returns {string} Resource name string. + */ + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ + project: project, + location: location, + tls_inspection_policy: tlsInspectionPolicy, + }); + } + + /** + * Parse the project from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; + } + + /** + * Parse the location from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; + } + + /** + * Parse the tls_inspection_policy from TlsInspectionPolicy resource. + * + * @param {string} tlsInspectionPolicyName + * A fully-qualified path representing TlsInspectionPolicy resource. + * @returns {string} A string representing the tls_inspection_policy. + */ + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; + } + + /** + * Return a fully-qualified urlList resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} url_list + * @returns {string} Resource name string. + */ + urlListPath(project: string, location: string, urlList: string) { + return this.pathTemplates.urlListPathTemplate.render({ + project: project, + location: location, + url_list: urlList, + }); + } + + /** + * Parse the project from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the project. + */ + matchProjectFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).project; + } + + /** + * Parse the location from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the location. + */ + matchLocationFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).location; + } + + /** + * Parse the url_list from UrlList resource. + * + * @param {string} urlListName + * A fully-qualified path representing UrlList resource. + * @returns {string} A string representing the url_list. + */ + matchUrlListFromUrlListName(urlListName: string) { + return this.pathTemplates.urlListPathTemplate.match(urlListName).url_list; + } + + /** + * 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.securityProfileGroupServiceStub && !this._terminated) { + return this.securityProfileGroupServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client_config.json b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client_config.json new file mode 100644 index 000000000000..d73fb33c3eb0 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.networksecurity.v1.SecurityProfileGroupService": { + "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": { + "ListSecurityProfileGroups": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSecurityProfileGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSecurityProfileGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityProfileGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSecurityProfileGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSecurityProfiles": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSecurityProfile": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSecurityProfile": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityProfile": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSecurityProfile": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_proto_list.json b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_proto_list.json new file mode 100644 index 000000000000..2138f74b5c58 --- /dev/null +++ b/packages/google-cloud-networksecurity/src/v1/security_profile_group_service_proto_list.json @@ -0,0 +1,26 @@ +[ + "../../protos/google/cloud/networksecurity/v1/address_group.proto", + "../../protos/google/cloud/networksecurity/v1/authorization_policy.proto", + "../../protos/google/cloud/networksecurity/v1/authz_policy.proto", + "../../protos/google/cloud/networksecurity/v1/backend_authentication_config.proto", + "../../protos/google/cloud/networksecurity/v1/client_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/common.proto", + "../../protos/google/cloud/networksecurity/v1/dns_threat_detector.proto", + "../../protos/google/cloud/networksecurity/v1/firewall_activation.proto", + "../../protos/google/cloud/networksecurity/v1/gateway_security_policy.proto", + "../../protos/google/cloud/networksecurity/v1/gateway_security_policy_rule.proto", + "../../protos/google/cloud/networksecurity/v1/intercept.proto", + "../../protos/google/cloud/networksecurity/v1/mirroring.proto", + "../../protos/google/cloud/networksecurity/v1/network_security.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_intercept.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_mirroring.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_service.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_threatprevention.proto", + "../../protos/google/cloud/networksecurity/v1/security_profile_group_urlfiltering.proto", + "../../protos/google/cloud/networksecurity/v1/server_tls_policy.proto", + "../../protos/google/cloud/networksecurity/v1/sse_realm.proto", + "../../protos/google/cloud/networksecurity/v1/tls.proto", + "../../protos/google/cloud/networksecurity/v1/tls_inspection_policy.proto", + "../../protos/google/cloud/networksecurity/v1/url_list.proto" +] diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/dns_threat_detector_service_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/dns_threat_detector_service_client.ts index b9232a3260a1..d574568593ee 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/dns_threat_detector_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/dns_threat_detector_service_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +55,7 @@ export class DnsThreatDetectorServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,11 +68,11 @@ export class DnsThreatDetectorServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - dnsThreatDetectorServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + dnsThreatDetectorServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of DnsThreatDetectorServiceClient. @@ -102,21 +113,43 @@ export class DnsThreatDetectorServiceClient { * const client = new DnsThreatDetectorServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DnsThreatDetectorServiceClient; - 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 staticMembers = this + .constructor as typeof DnsThreatDetectorServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -141,7 +174,7 @@ export class DnsThreatDetectorServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,18 +187,14 @@ export class DnsThreatDetectorServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -187,103 +216,111 @@ export class DnsThreatDetectorServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -291,14 +328,20 @@ export class DnsThreatDetectorServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listDnsThreatDetectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dnsThreatDetectors') + listDnsThreatDetectors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dnsThreatDetectors', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService', + 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 @@ -329,37 +372,47 @@ export class DnsThreatDetectorServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService. this.dnsThreatDetectorServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.DnsThreatDetectorService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .DnsThreatDetectorService, + 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 dnsThreatDetectorServiceStubMethods = - ['listDnsThreatDetectors', 'getDnsThreatDetector', 'createDnsThreatDetector', 'updateDnsThreatDetector', 'deleteDnsThreatDetector']; + const dnsThreatDetectorServiceStubMethods = [ + 'listDnsThreatDetectors', + 'getDnsThreatDetector', + 'createDnsThreatDetector', + 'updateDnsThreatDetector', + 'deleteDnsThreatDetector', + ]; for (const methodName of dnsThreatDetectorServiceStubMethods) { const callPromise = this.dnsThreatDetectorServiceStub.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) => () => { + (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] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -374,8 +427,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -386,8 +445,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -418,9 +483,7 @@ export class DnsThreatDetectorServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -429,8 +492,9 @@ export class DnsThreatDetectorServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -441,478 +505,699 @@ export class DnsThreatDetectorServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets the details of a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1alpha1/dns_threat_detector_service.get_dns_threat_detector.js - * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async - */ + /** + * Gets the details of a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1alpha1/dns_threat_detector_service.get_dns_threat_detector.js + * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async + */ getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new DnsThreatDetector in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The value for the parent of the DnsThreatDetector resource. - * @param {string} [request.dnsThreatDetectorId] - * Optional. The ID of the requesting DnsThreatDetector object. - * If this field is not supplied, the service generates an identifier. - * @param {google.cloud.networksecurity.v1alpha1.DnsThreatDetector} request.dnsThreatDetector - * Required. The `DnsThreatDetector` resource to create. - * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1alpha1/dns_threat_detector_service.create_dns_threat_detector.js - * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async - */ + /** + * Creates a new DnsThreatDetector in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The value for the parent of the DnsThreatDetector resource. + * @param {string} [request.dnsThreatDetectorId] + * Optional. The ID of the requesting DnsThreatDetector object. + * If this field is not supplied, the service generates an identifier. + * @param {google.cloud.networksecurity.v1alpha1.DnsThreatDetector} request.dnsThreatDetector + * Required. The `DnsThreatDetector` resource to create. + * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1alpha1/dns_threat_detector_service.create_dns_threat_detector.js + * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async + */ createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The field mask is used to specify the fields to be overwritten in - * the DnsThreatDetector resource by the update. The fields specified in the - * update_mask are relative to the resource, not the full request. A field - * will be overwritten if it is in the mask. If the mask is not provided then - * all fields present in the request will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.DnsThreatDetector} request.dnsThreatDetector - * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1alpha1/dns_threat_detector_service.update_dns_threat_detector.js - * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async - */ + /** + * Updates a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The field mask is used to specify the fields to be overwritten in + * the DnsThreatDetector resource by the update. The fields specified in the + * update_mask are relative to the resource, not the full request. A field + * will be overwritten if it is in the mask. If the mask is not provided then + * all fields present in the request will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.DnsThreatDetector} request.dnsThreatDetector + * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1alpha1/dns_threat_detector_service.update_dns_threat_detector.js + * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async + */ updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1alpha1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. - * 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/v1alpha1/dns_threat_detector_service.delete_dns_threat_detector.js - * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async - */ + /** + * Deletes a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. + * 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/v1alpha1/dns_threat_detector_service.delete_dns_threat_detector.js + * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async + */ deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1alpha1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists DnsThreatDetectors in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. - * 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Lists DnsThreatDetectors in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. + * 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse, + ] + >; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDnsThreatDetectors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -921,139 +1206,143 @@ export class DnsThreatDetectorServiceClient { this._log.info('listDnsThreatDetectors request %j', request); return this.innerApiCalls .listDnsThreatDetectors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse - ]) => { - this._log.info('listDnsThreatDetectors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsResponse, + ]) => { + this._log.info('listDnsThreatDetectors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectorsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors stream %j', request); return this.descriptors.page.listDnsThreatDetectors.createStream( this.innerApiCalls.listDnsThreatDetectors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. 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/v1alpha1/dns_threat_detector_service.list_dns_threat_detectors.js - * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async - */ + /** + * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1alpha1.DnsThreatDetector|DnsThreatDetector}. 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/v1alpha1/dns_threat_detector_service.list_dns_threat_detectors.js + * region_tag:networksecurity_v1alpha1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async + */ listDnsThreatDetectorsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors iterate %j', request); return this.descriptors.page.listDnsThreatDetectors.asyncIterate( this.innerApiCalls['listDnsThreatDetectors'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1067,40 +1356,40 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1114,41 +1403,41 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1162,12 +1451,12 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1202,12 +1491,11 @@ export class DnsThreatDetectorServiceClient { | 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. @@ -1240,7 +1528,7 @@ export class DnsThreatDetectorServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1257,7 +1545,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -1273,7 +1565,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -1284,7 +1578,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -1294,8 +1590,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -1306,7 +1606,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -1322,7 +1622,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -1333,7 +1634,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -1344,7 +1646,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -1355,7 +1658,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -1370,8 +1677,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -1381,8 +1692,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -1392,8 +1707,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -1404,7 +1723,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -1420,7 +1743,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -1431,7 +1756,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -1442,7 +1769,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -1453,7 +1782,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -1469,7 +1802,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -1480,7 +1815,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -1490,8 +1827,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -1502,7 +1843,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -1517,8 +1862,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -1528,8 +1877,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -1539,8 +1892,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -1551,7 +1908,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -1567,7 +1928,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -1577,8 +1940,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -1588,8 +1955,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -1601,7 +1972,12 @@ export class DnsThreatDetectorServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -1617,8 +1993,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -1628,8 +2008,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -1639,8 +2023,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -1650,8 +2038,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -1662,7 +2054,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -1678,7 +2074,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -1689,7 +2087,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -1699,8 +2099,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -1711,7 +2115,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -1726,8 +2134,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -1737,8 +2149,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -1748,8 +2164,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -1760,7 +2180,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -1775,8 +2199,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -1786,8 +2214,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -1797,8 +2229,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -1809,12 +2245,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -1824,8 +2266,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -1835,8 +2281,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -1846,8 +2296,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -1857,7 +2311,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1894,7 +2348,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -1910,7 +2368,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -1921,7 +2381,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -1931,8 +2393,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -1943,7 +2409,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -1958,8 +2428,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -1969,8 +2443,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -1980,8 +2458,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -1992,7 +2474,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2007,8 +2493,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2018,8 +2508,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -2029,8 +2523,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -2041,12 +2539,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -2056,8 +2560,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -2067,8 +2575,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -2078,8 +2590,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -2089,7 +2605,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -2126,12 +2642,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -2141,8 +2663,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -2152,8 +2678,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -2163,8 +2693,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -2175,12 +2709,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -2190,8 +2730,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -2201,8 +2745,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -2212,8 +2760,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -2224,12 +2776,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -2239,8 +2797,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -2250,8 +2812,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -2261,8 +2827,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -2273,7 +2843,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -2289,7 +2863,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -2300,7 +2876,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -2310,8 +2888,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -2322,7 +2904,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -2338,7 +2924,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -2349,7 +2937,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -2360,7 +2950,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -2369,7 +2961,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2394,12 +2986,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -2409,8 +3007,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -2420,8 +3022,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -2431,8 +3037,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -2443,12 +3053,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -2458,8 +3074,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -2469,8 +3089,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -2480,8 +3104,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -2492,12 +3120,18 @@ export class DnsThreatDetectorServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -2507,8 +3141,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -2518,8 +3156,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -2529,8 +3171,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -2541,7 +3187,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -2557,7 +3203,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -2568,7 +3215,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -2579,7 +3227,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -2590,7 +3239,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -2628,7 +3277,8 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -2639,7 +3289,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -2655,7 +3309,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -2666,7 +3322,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -2676,8 +3334,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -2688,7 +3350,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2704,7 +3370,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -2715,7 +3383,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -2726,7 +3396,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -2737,7 +3409,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -2753,7 +3429,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -2764,7 +3442,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -2774,8 +3454,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -2786,7 +3470,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -2835,14 +3519,18 @@ export class DnsThreatDetectorServiceClient { */ close(): Promise { if (this.dnsThreatDetectorServiceStub && !this._terminated) { - return this.dnsThreatDetectorServiceStub.then(stub => { + return this.dnsThreatDetectorServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/firewall_activation_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/firewall_activation_client.ts index f63eb521732d..4b75730c794f 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/firewall_activation_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/firewall_activation_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class FirewallActivationClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class FirewallActivationClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - firewallActivationStub?: Promise<{[name: string]: Function}>; + firewallActivationStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of FirewallActivationClient. @@ -103,21 +116,42 @@ export class FirewallActivationClient { * const client = new FirewallActivationClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof FirewallActivationClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class FirewallActivationClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class FirewallActivationClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,106 +218,114 @@ export class FirewallActivationClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' + 'organizations/{organization}', ), organizationLocationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'organizations/{organization}/locations/{location}', ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -295,10 +333,16 @@ export class FirewallActivationClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listFirewallEndpoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'firewallEndpoints'), - listFirewallEndpointAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'firewallEndpointAssociations') + listFirewallEndpoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'firewallEndpoints', + ), + listFirewallEndpointAssociations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'firewallEndpointAssociations', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -307,76 +351,229 @@ export class FirewallActivationClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.FirewallEndpoint') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.FirewallEndpoint', + ) as gax.protobuf.Type; const createFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateFirewallEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.FirewallEndpoint') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.FirewallEndpoint', + ) as gax.protobuf.Type; const updateFirewallEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation', + ) as gax.protobuf.Type; const createFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateFirewallEndpointAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation', + ) as gax.protobuf.Type; const updateFirewallEndpointAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createFirewallEndpointResponse.decode.bind(createFirewallEndpointResponse), - createFirewallEndpointMetadata.decode.bind(createFirewallEndpointMetadata)), + createFirewallEndpointResponse.decode.bind( + createFirewallEndpointResponse, + ), + createFirewallEndpointMetadata.decode.bind( + createFirewallEndpointMetadata, + ), + ), deleteFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteFirewallEndpointResponse.decode.bind(deleteFirewallEndpointResponse), - deleteFirewallEndpointMetadata.decode.bind(deleteFirewallEndpointMetadata)), + deleteFirewallEndpointResponse.decode.bind( + deleteFirewallEndpointResponse, + ), + deleteFirewallEndpointMetadata.decode.bind( + deleteFirewallEndpointMetadata, + ), + ), updateFirewallEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateFirewallEndpointResponse.decode.bind(updateFirewallEndpointResponse), - updateFirewallEndpointMetadata.decode.bind(updateFirewallEndpointMetadata)), - createFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFirewallEndpointAssociationResponse.decode.bind(createFirewallEndpointAssociationResponse), - createFirewallEndpointAssociationMetadata.decode.bind(createFirewallEndpointAssociationMetadata)), - deleteFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFirewallEndpointAssociationResponse.decode.bind(deleteFirewallEndpointAssociationResponse), - deleteFirewallEndpointAssociationMetadata.decode.bind(deleteFirewallEndpointAssociationMetadata)), - updateFirewallEndpointAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFirewallEndpointAssociationResponse.decode.bind(updateFirewallEndpointAssociationResponse), - updateFirewallEndpointAssociationMetadata.decode.bind(updateFirewallEndpointAssociationMetadata)) + updateFirewallEndpointResponse.decode.bind( + updateFirewallEndpointResponse, + ), + updateFirewallEndpointMetadata.decode.bind( + updateFirewallEndpointMetadata, + ), + ), + createFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFirewallEndpointAssociationResponse.decode.bind( + createFirewallEndpointAssociationResponse, + ), + createFirewallEndpointAssociationMetadata.decode.bind( + createFirewallEndpointAssociationMetadata, + ), + ), + deleteFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFirewallEndpointAssociationResponse.decode.bind( + deleteFirewallEndpointAssociationResponse, + ), + deleteFirewallEndpointAssociationMetadata.decode.bind( + deleteFirewallEndpointAssociationMetadata, + ), + ), + updateFirewallEndpointAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFirewallEndpointAssociationResponse.decode.bind( + updateFirewallEndpointAssociationResponse, + ), + updateFirewallEndpointAssociationMetadata.decode.bind( + updateFirewallEndpointAssociationMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.FirewallActivation', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.FirewallActivation', + 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 @@ -407,28 +604,45 @@ export class FirewallActivationClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.FirewallActivation. this.firewallActivationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.FirewallActivation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.FirewallActivation, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.FirewallActivation', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .FirewallActivation, + 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 firewallActivationStubMethods = - ['listFirewallEndpoints', 'getFirewallEndpoint', 'createFirewallEndpoint', 'deleteFirewallEndpoint', 'updateFirewallEndpoint', 'listFirewallEndpointAssociations', 'getFirewallEndpointAssociation', 'createFirewallEndpointAssociation', 'deleteFirewallEndpointAssociation', 'updateFirewallEndpointAssociation']; + const firewallActivationStubMethods = [ + 'listFirewallEndpoints', + 'getFirewallEndpoint', + 'createFirewallEndpoint', + 'deleteFirewallEndpoint', + 'updateFirewallEndpoint', + 'listFirewallEndpointAssociations', + 'getFirewallEndpointAssociation', + 'createFirewallEndpointAssociation', + 'deleteFirewallEndpointAssociation', + 'updateFirewallEndpointAssociation', + ]; for (const methodName of firewallActivationStubMethods) { const callPromise = this.firewallActivationStub.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) => () => { + (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] || @@ -438,7 +652,7 @@ export class FirewallActivationClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -453,8 +667,14 @@ export class FirewallActivationClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -465,8 +685,14 @@ export class FirewallActivationClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -497,9 +723,7 @@ export class FirewallActivationClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -508,8 +732,9 @@ export class FirewallActivationClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -520,1031 +745,1551 @@ export class FirewallActivationClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. - * 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/v1alpha1/firewall_activation.get_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_GetFirewallEndpoint_async - */ + /** + * Gets details of a single Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. + * 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/v1alpha1/firewall_activation.get_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_GetFirewallEndpoint_async + */ getFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ] + >; getFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFirewallEndpoint request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getFirewallEndpoint response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFirewallEndpoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getFirewallEndpoint response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. - * 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/v1alpha1/firewall_activation.get_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_GetFirewallEndpointAssociation_async - */ + /** + * Gets details of a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. + * 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/v1alpha1/firewall_activation.get_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_GetFirewallEndpointAssociation_async + */ getFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFirewallEndpointAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getFirewallEndpointAssociation response %j', response); + this._log.info( + 'getFirewallEndpointAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFirewallEndpointAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetFirewallEndpointAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getFirewallEndpointAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new FirewallEndpoint in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.firewallEndpointId - * Required. Id of the requesting object. - * If auto-generating Id server-side, remove this field and - * firewall_endpoint_id from the method_signature of Create RPC. - * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpoint} request.firewallEndpoint - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.create_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpoint_async - */ + /** + * Creates a new FirewallEndpoint in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.firewallEndpointId + * Required. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_id from the method_signature of Create RPC. + * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.create_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpoint_async + */ createFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createFirewallEndpoint request %j', request); - return this.innerApiCalls.createFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createFirewallEndpoint()`. - * @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/v1alpha1/firewall_activation.create_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpoint_async - */ - async checkCreateFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createFirewallEndpoint()`. + * @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/v1alpha1/firewall_activation.create_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpoint_async + */ + async checkCreateFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.delete_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpoint_async - */ + /** + * Deletes a single Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.delete_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpoint_async + */ deleteFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteFirewallEndpoint request %j', request); - return this.innerApiCalls.deleteFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteFirewallEndpoint()`. - * @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/v1alpha1/firewall_activation.delete_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpoint_async - */ - async checkDeleteFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteFirewallEndpoint()`. + * @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/v1alpha1/firewall_activation.delete_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpoint_async + */ + async checkDeleteFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Update a single Endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Endpoint resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpoint} request.firewallEndpoint - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.update_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpoint_async - */ + /** + * Update a single Endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Endpoint resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpoint} request.firewallEndpoint + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.update_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpoint_async + */ updateFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpoint( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpoint( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'firewall_endpoint.name': request.firewallEndpoint!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'firewall_endpoint.name': request.firewallEndpoint!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateFirewallEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateFirewallEndpoint request %j', request); - return this.innerApiCalls.updateFirewallEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateFirewallEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateFirewallEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateFirewallEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateFirewallEndpoint()`. - * @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/v1alpha1/firewall_activation.update_firewall_endpoint.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpoint_async - */ - async checkUpdateFirewallEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateFirewallEndpoint()`. + * @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/v1alpha1/firewall_activation.update_firewall_endpoint.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpoint_async + */ + async checkUpdateFirewallEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateFirewallEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateFirewallEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFirewallEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new FirewallEndpointAssociation in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} [request.firewallEndpointAssociationId] - * Optional. Id of the requesting object. - * If auto-generating Id server-side, remove this field and - * firewall_endpoint_association_id from the method_signature of Create RPC. - * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation} request.firewallEndpointAssociation - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.create_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async - */ + /** + * Creates a new FirewallEndpointAssociation in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} [request.firewallEndpointAssociationId] + * Optional. Id of the requesting object. + * If auto-generating Id server-side, remove this field and + * firewall_endpoint_association_id from the method_signature of Create RPC. + * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation} request.firewallEndpointAssociation + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.create_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async + */ createFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'createFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.createFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createFirewallEndpointAssociation()`. - * @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/v1alpha1/firewall_activation.create_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async - */ - async checkCreateFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createFirewallEndpointAssociation()`. + * @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/v1alpha1/firewall_activation.create_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_CreateFirewallEndpointAssociation_async + */ + async checkCreateFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.delete_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async - */ + /** + * Deletes a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.delete_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async + */ deleteFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'deleteFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.deleteFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteFirewallEndpointAssociation()`. - * @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/v1alpha1/firewall_activation.delete_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async - */ - async checkDeleteFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteFirewallEndpointAssociation()`. + * @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/v1alpha1/firewall_activation.delete_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_DeleteFirewallEndpointAssociation_async + */ + async checkDeleteFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Update a single FirewallEndpointAssociation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Association resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation} request.firewallEndpointAssociation - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/firewall_activation.update_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async - */ + /** + * Update a single FirewallEndpointAssociation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Association resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation} request.firewallEndpointAssociation + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/firewall_activation.update_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async + */ updateFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpointAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateFirewallEndpointAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateFirewallEndpointAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'firewall_endpoint_association.name': request.firewallEndpointAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'firewall_endpoint_association.name': + request.firewallEndpointAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateFirewallEndpointAssociation response %j', rawResponse); + this._log.info( + 'updateFirewallEndpointAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateFirewallEndpointAssociation request %j', request); - return this.innerApiCalls.updateFirewallEndpointAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateFirewallEndpointAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateFirewallEndpointAssociation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateFirewallEndpointAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateFirewallEndpointAssociation()`. - * @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/v1alpha1/firewall_activation.update_firewall_endpoint_association.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async - */ - async checkUpdateFirewallEndpointAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateFirewallEndpointAssociation()`. + * @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/v1alpha1/firewall_activation.update_firewall_endpoint_association.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_UpdateFirewallEndpointAssociation_async + */ + async checkUpdateFirewallEndpointAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateFirewallEndpointAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateFirewallEndpointAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists FirewallEndpoints in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. - * 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 `listFirewallEndpointsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFirewallEndpointAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists FirewallEndpoints in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. + * 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 `listFirewallEndpointsAsync()` + * 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. + */ listFirewallEndpoints( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse, + ] + >; listFirewallEndpoints( - request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint + >, + ): void; listFirewallEndpoints( - request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint + >, + ): void; listFirewallEndpoints( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFirewallEndpoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1553,204 +2298,233 @@ export class FirewallActivationClient { this._log.info('listFirewallEndpoints request %j', request); return this.innerApiCalls .listFirewallEndpoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse - ]) => { - this._log.info('listFirewallEndpoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsResponse, + ]) => { + this._log.info('listFirewallEndpoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFirewallEndpoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint} 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 `listFirewallEndpointsAsync()` - * 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. - */ + /** + * Equivalent to `listFirewallEndpoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint} 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 `listFirewallEndpointsAsync()` + * 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. + */ listFirewallEndpointsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFirewallEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpoints stream %j', request); return this.descriptors.page.listFirewallEndpoints.createStream( this.innerApiCalls.listFirewallEndpoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFirewallEndpoints`, 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. Parent value for ListEndpointsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. 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/v1alpha1/firewall_activation.list_firewall_endpoints.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_ListFirewallEndpoints_async - */ + /** + * Equivalent to `listFirewallEndpoints`, 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. Parent value for ListEndpointsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpoint|FirewallEndpoint}. 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/v1alpha1/firewall_activation.list_firewall_endpoints.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_ListFirewallEndpoints_async + */ listFirewallEndpointsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFirewallEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpoints iterate %j', request); return this.descriptors.page.listFirewallEndpoints.asyncIterate( this.innerApiCalls['listFirewallEndpoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Associations in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. - * 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 `listFirewallEndpointAssociationsAsync()` - * 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. - */ + /** + * Lists Associations in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. + * 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 `listFirewallEndpointAssociationsAsync()` + * 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. + */ listFirewallEndpointAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse, + ] + >; listFirewallEndpointAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation + >, + ): void; listFirewallEndpointAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation + >, + ): void; listFirewallEndpointAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFirewallEndpointAssociations values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1759,143 +2533,152 @@ export class FirewallActivationClient { this._log.info('listFirewallEndpointAssociations request %j', request); return this.innerApiCalls .listFirewallEndpointAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse - ]) => { - this._log.info('listFirewallEndpointAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsResponse, + ]) => { + this._log.info( + 'listFirewallEndpointAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFirewallEndpointAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation} 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 `listFirewallEndpointAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listFirewallEndpointAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation} 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 `listFirewallEndpointAssociationsAsync()` + * 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. + */ listFirewallEndpointAssociationsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + 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['listFirewallEndpointAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listFirewallEndpointAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpointAssociations stream %j', request); return this.descriptors.page.listFirewallEndpointAssociations.createStream( this.innerApiCalls.listFirewallEndpointAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFirewallEndpointAssociations`, 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. Parent value for ListAssociationsRequest - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. 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/v1alpha1/firewall_activation.list_firewall_endpoint_associations.js - * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_ListFirewallEndpointAssociations_async - */ + /** + * Equivalent to `listFirewallEndpointAssociations`, 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. Parent value for ListAssociationsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.FirewallEndpointAssociation|FirewallEndpointAssociation}. 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/v1alpha1/firewall_activation.list_firewall_endpoint_associations.js + * region_tag:networksecurity_v1alpha1_generated_FirewallActivation_ListFirewallEndpointAssociations_async + */ listFirewallEndpointAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListFirewallEndpointAssociationsRequest, + 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['listFirewallEndpointAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listFirewallEndpointAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFirewallEndpointAssociations iterate %j', request); return this.descriptors.page.listFirewallEndpointAssociations.asyncIterate( this.innerApiCalls['listFirewallEndpointAssociations'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1909,40 +2692,40 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1956,41 +2739,41 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -2004,12 +2787,12 @@ export class FirewallActivationClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -2044,12 +2827,11 @@ export class FirewallActivationClient { | 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. @@ -2082,12 +2864,12 @@ export class FirewallActivationClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2130,22 +2912,22 @@ export class FirewallActivationClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2180,15 +2962,15 @@ export class FirewallActivationClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2222,7 +3004,7 @@ export class FirewallActivationClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2235,25 +3017,24 @@ export class FirewallActivationClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2292,22 +3073,22 @@ export class FirewallActivationClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2323,7 +3104,11 @@ export class FirewallActivationClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2339,7 +3124,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2350,7 +3137,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2360,8 +3149,12 @@ export class FirewallActivationClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2372,7 +3165,7 @@ export class FirewallActivationClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2388,7 +3181,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2399,7 +3193,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2410,7 +3205,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2421,7 +3217,11 @@ export class FirewallActivationClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2436,8 +3236,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2447,8 +3251,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2458,8 +3266,12 @@ export class FirewallActivationClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2470,7 +3282,11 @@ export class FirewallActivationClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2486,7 +3302,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2497,7 +3315,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2508,7 +3328,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2519,7 +3341,11 @@ export class FirewallActivationClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2535,7 +3361,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2546,7 +3374,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2556,8 +3386,12 @@ export class FirewallActivationClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2568,7 +3402,11 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2583,8 +3421,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2594,8 +3436,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2605,8 +3451,12 @@ export class FirewallActivationClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2617,7 +3467,11 @@ export class FirewallActivationClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2633,7 +3487,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2643,8 +3499,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2654,8 +3514,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2667,7 +3531,12 @@ export class FirewallActivationClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2683,8 +3552,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2694,8 +3567,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2705,8 +3582,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2716,8 +3597,12 @@ export class FirewallActivationClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2728,7 +3613,11 @@ export class FirewallActivationClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2744,7 +3633,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2755,7 +3646,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2765,8 +3658,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2777,7 +3674,11 @@ export class FirewallActivationClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2792,8 +3693,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2803,8 +3708,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2814,8 +3723,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2826,7 +3739,11 @@ export class FirewallActivationClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2841,8 +3758,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2852,8 +3773,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2863,8 +3788,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2875,12 +3804,18 @@ export class FirewallActivationClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2890,8 +3825,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2901,8 +3840,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2912,8 +3855,12 @@ export class FirewallActivationClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2923,7 +3870,7 @@ export class FirewallActivationClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2960,7 +3907,11 @@ export class FirewallActivationClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2976,7 +3927,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2987,7 +3940,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2997,8 +3952,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -3009,7 +3968,11 @@ export class FirewallActivationClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -3024,8 +3987,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -3035,8 +4002,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -3046,8 +4017,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -3058,7 +4033,11 @@ export class FirewallActivationClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -3073,8 +4052,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -3084,8 +4067,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -3095,8 +4082,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -3107,12 +4098,18 @@ export class FirewallActivationClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3122,8 +4119,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3133,8 +4134,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3144,8 +4149,12 @@ export class FirewallActivationClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3154,7 +4163,7 @@ export class FirewallActivationClient { * @param {string} organization * @returns {string} Resource name string. */ - organizationPath(organization:string) { + organizationPath(organization: string) { return this.pathTemplates.organizationPathTemplate.render({ organization: organization, }); @@ -3168,7 +4177,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; } /** @@ -3178,7 +4188,7 @@ export class FirewallActivationClient { * @param {string} location * @returns {string} Resource name string. */ - organizationLocationPath(organization:string,location:string) { + organizationLocationPath(organization: string, location: string) { return this.pathTemplates.organizationLocationPathTemplate.render({ organization: organization, location: location, @@ -3192,8 +4202,12 @@ export class FirewallActivationClient { * A fully-qualified path representing OrganizationLocation resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).organization; + matchOrganizationFromOrganizationLocationName( + organizationLocationName: string, + ) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).organization; } /** @@ -3204,7 +4218,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).location; + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).location; } /** @@ -3215,12 +4231,18 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3230,8 +4252,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3241,8 +4267,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3252,8 +4282,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3264,12 +4298,18 @@ export class FirewallActivationClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3279,8 +4319,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3290,8 +4334,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3301,8 +4349,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3313,12 +4365,18 @@ export class FirewallActivationClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3328,8 +4386,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3339,8 +4401,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3350,8 +4416,12 @@ export class FirewallActivationClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3362,7 +4432,11 @@ export class FirewallActivationClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -3378,7 +4452,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -3389,7 +4465,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -3399,8 +4477,12 @@ export class FirewallActivationClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -3411,7 +4493,11 @@ export class FirewallActivationClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -3427,7 +4513,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -3438,7 +4526,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -3449,7 +4539,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -3458,7 +4550,7 @@ export class FirewallActivationClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3483,12 +4575,18 @@ export class FirewallActivationClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3498,8 +4596,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3509,8 +4611,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3520,8 +4626,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3532,12 +4642,18 @@ export class FirewallActivationClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3547,8 +4663,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3558,8 +4678,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3569,8 +4693,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3581,12 +4709,18 @@ export class FirewallActivationClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3596,8 +4730,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3607,8 +4745,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3618,8 +4760,12 @@ export class FirewallActivationClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3630,7 +4776,7 @@ export class FirewallActivationClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -3646,7 +4792,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -3657,7 +4804,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -3668,7 +4816,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -3679,7 +4828,7 @@ export class FirewallActivationClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -3717,7 +4866,8 @@ export class FirewallActivationClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3728,7 +4878,11 @@ export class FirewallActivationClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -3744,7 +4898,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -3755,7 +4911,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -3765,8 +4923,12 @@ export class FirewallActivationClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -3777,7 +4939,11 @@ export class FirewallActivationClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3793,7 +4959,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3804,7 +4972,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3815,7 +4985,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3826,7 +4998,11 @@ export class FirewallActivationClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3842,7 +5018,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3853,7 +5031,9 @@ export class FirewallActivationClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3863,8 +5043,12 @@ export class FirewallActivationClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3875,7 +5059,7 @@ export class FirewallActivationClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3924,15 +5108,19 @@ export class FirewallActivationClient { */ close(): Promise { if (this.firewallActivationStub && !this._terminated) { - return this.firewallActivationStub.then(stub => { + return this.firewallActivationStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/index.ts b/packages/google-cloud-networksecurity/src/v1alpha1/index.ts index 0715589fe2f2..b7ba93901e67 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/index.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/index.ts @@ -16,11 +16,11 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {DnsThreatDetectorServiceClient} from './dns_threat_detector_service_client'; -export {FirewallActivationClient} from './firewall_activation_client'; -export {InterceptClient} from './intercept_client'; -export {MirroringClient} from './mirroring_client'; -export {NetworkSecurityClient} from './network_security_client'; -export {OrganizationSecurityProfileGroupServiceClient} from './organization_security_profile_group_service_client'; -export {SSEGatewayServiceClient} from './s_s_e_gateway_service_client'; -export {SSERealmServiceClient} from './s_s_e_realm_service_client'; +export { DnsThreatDetectorServiceClient } from './dns_threat_detector_service_client'; +export { FirewallActivationClient } from './firewall_activation_client'; +export { InterceptClient } from './intercept_client'; +export { MirroringClient } from './mirroring_client'; +export { NetworkSecurityClient } from './network_security_client'; +export { OrganizationSecurityProfileGroupServiceClient } from './organization_security_profile_group_service_client'; +export { SSEGatewayServiceClient } from './s_s_e_gateway_service_client'; +export { SSERealmServiceClient } from './s_s_e_realm_service_client'; diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/intercept_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/intercept_client.ts index d1fdc7a31680..b232cdc33f2e 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/intercept_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/intercept_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +58,7 @@ export class InterceptClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -58,12 +71,12 @@ export class InterceptClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - interceptStub?: Promise<{[name: string]: Function}>; + interceptStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of InterceptClient. @@ -104,21 +117,42 @@ export class InterceptClient { * const client = new InterceptClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InterceptClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -143,7 +177,7 @@ export class InterceptClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -156,18 +190,14 @@ export class InterceptClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -189,106 +219,114 @@ export class InterceptClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), forwardingRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/forwardingRules/{forwarding_rule}' + 'projects/{project}/global/forwardingRules/{forwarding_rule}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -296,14 +334,27 @@ export class InterceptClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listInterceptEndpointGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptEndpointGroups'), + listInterceptEndpointGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptEndpointGroups', + ), listInterceptEndpointGroupAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptEndpointGroupAssociations'), - listInterceptDeploymentGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptDeploymentGroups'), - listInterceptDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'interceptDeployments') + new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptEndpointGroupAssociations', + ), + listInterceptDeploymentGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptDeploymentGroups', + ), + listInterceptDeployments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'interceptDeployments', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -312,124 +363,323 @@ export class InterceptClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup', + ) as gax.protobuf.Type; const createInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup', + ) as gax.protobuf.Type; const updateInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptEndpointGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation') as gax.protobuf.Type; - const createInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation') as gax.protobuf.Type; - const updateInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteInterceptEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInterceptEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const createInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation', + ) as gax.protobuf.Type; + const createInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const updateInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation', + ) as gax.protobuf.Type; + const updateInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteInterceptEndpointGroupAssociationResponse = + protoFilesRoot.lookup('.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInterceptEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup', + ) as gax.protobuf.Type; const createInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup', + ) as gax.protobuf.Type; const updateInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptDeployment', + ) as gax.protobuf.Type; const createInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.InterceptDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.InterceptDeployment', + ) as gax.protobuf.Type; const updateInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteInterceptDeploymentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteInterceptDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptEndpointGroupResponse.decode.bind(createInterceptEndpointGroupResponse), - createInterceptEndpointGroupMetadata.decode.bind(createInterceptEndpointGroupMetadata)), + createInterceptEndpointGroupResponse.decode.bind( + createInterceptEndpointGroupResponse, + ), + createInterceptEndpointGroupMetadata.decode.bind( + createInterceptEndpointGroupMetadata, + ), + ), updateInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptEndpointGroupResponse.decode.bind(updateInterceptEndpointGroupResponse), - updateInterceptEndpointGroupMetadata.decode.bind(updateInterceptEndpointGroupMetadata)), + updateInterceptEndpointGroupResponse.decode.bind( + updateInterceptEndpointGroupResponse, + ), + updateInterceptEndpointGroupMetadata.decode.bind( + updateInterceptEndpointGroupMetadata, + ), + ), deleteInterceptEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptEndpointGroupResponse.decode.bind(deleteInterceptEndpointGroupResponse), - deleteInterceptEndpointGroupMetadata.decode.bind(deleteInterceptEndpointGroupMetadata)), - createInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInterceptEndpointGroupAssociationResponse.decode.bind(createInterceptEndpointGroupAssociationResponse), - createInterceptEndpointGroupAssociationMetadata.decode.bind(createInterceptEndpointGroupAssociationMetadata)), - updateInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInterceptEndpointGroupAssociationResponse.decode.bind(updateInterceptEndpointGroupAssociationResponse), - updateInterceptEndpointGroupAssociationMetadata.decode.bind(updateInterceptEndpointGroupAssociationMetadata)), - deleteInterceptEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInterceptEndpointGroupAssociationResponse.decode.bind(deleteInterceptEndpointGroupAssociationResponse), - deleteInterceptEndpointGroupAssociationMetadata.decode.bind(deleteInterceptEndpointGroupAssociationMetadata)), + deleteInterceptEndpointGroupResponse.decode.bind( + deleteInterceptEndpointGroupResponse, + ), + deleteInterceptEndpointGroupMetadata.decode.bind( + deleteInterceptEndpointGroupMetadata, + ), + ), + createInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInterceptEndpointGroupAssociationResponse.decode.bind( + createInterceptEndpointGroupAssociationResponse, + ), + createInterceptEndpointGroupAssociationMetadata.decode.bind( + createInterceptEndpointGroupAssociationMetadata, + ), + ), + updateInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInterceptEndpointGroupAssociationResponse.decode.bind( + updateInterceptEndpointGroupAssociationResponse, + ), + updateInterceptEndpointGroupAssociationMetadata.decode.bind( + updateInterceptEndpointGroupAssociationMetadata, + ), + ), + deleteInterceptEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInterceptEndpointGroupAssociationResponse.decode.bind( + deleteInterceptEndpointGroupAssociationResponse, + ), + deleteInterceptEndpointGroupAssociationMetadata.decode.bind( + deleteInterceptEndpointGroupAssociationMetadata, + ), + ), createInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptDeploymentGroupResponse.decode.bind(createInterceptDeploymentGroupResponse), - createInterceptDeploymentGroupMetadata.decode.bind(createInterceptDeploymentGroupMetadata)), + createInterceptDeploymentGroupResponse.decode.bind( + createInterceptDeploymentGroupResponse, + ), + createInterceptDeploymentGroupMetadata.decode.bind( + createInterceptDeploymentGroupMetadata, + ), + ), updateInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptDeploymentGroupResponse.decode.bind(updateInterceptDeploymentGroupResponse), - updateInterceptDeploymentGroupMetadata.decode.bind(updateInterceptDeploymentGroupMetadata)), + updateInterceptDeploymentGroupResponse.decode.bind( + updateInterceptDeploymentGroupResponse, + ), + updateInterceptDeploymentGroupMetadata.decode.bind( + updateInterceptDeploymentGroupMetadata, + ), + ), deleteInterceptDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptDeploymentGroupResponse.decode.bind(deleteInterceptDeploymentGroupResponse), - deleteInterceptDeploymentGroupMetadata.decode.bind(deleteInterceptDeploymentGroupMetadata)), + deleteInterceptDeploymentGroupResponse.decode.bind( + deleteInterceptDeploymentGroupResponse, + ), + deleteInterceptDeploymentGroupMetadata.decode.bind( + deleteInterceptDeploymentGroupMetadata, + ), + ), createInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createInterceptDeploymentResponse.decode.bind(createInterceptDeploymentResponse), - createInterceptDeploymentMetadata.decode.bind(createInterceptDeploymentMetadata)), + createInterceptDeploymentResponse.decode.bind( + createInterceptDeploymentResponse, + ), + createInterceptDeploymentMetadata.decode.bind( + createInterceptDeploymentMetadata, + ), + ), updateInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateInterceptDeploymentResponse.decode.bind(updateInterceptDeploymentResponse), - updateInterceptDeploymentMetadata.decode.bind(updateInterceptDeploymentMetadata)), + updateInterceptDeploymentResponse.decode.bind( + updateInterceptDeploymentResponse, + ), + updateInterceptDeploymentMetadata.decode.bind( + updateInterceptDeploymentMetadata, + ), + ), deleteInterceptDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteInterceptDeploymentResponse.decode.bind(deleteInterceptDeploymentResponse), - deleteInterceptDeploymentMetadata.decode.bind(deleteInterceptDeploymentMetadata)) + deleteInterceptDeploymentResponse.decode.bind( + deleteInterceptDeploymentResponse, + ), + deleteInterceptDeploymentMetadata.decode.bind( + deleteInterceptDeploymentMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.Intercept', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.Intercept', + 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 @@ -460,28 +710,54 @@ export class InterceptClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.Intercept. this.interceptStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.Intercept') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.Intercept', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.networksecurity.v1alpha1.Intercept, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 interceptStubMethods = - ['listInterceptEndpointGroups', 'getInterceptEndpointGroup', 'createInterceptEndpointGroup', 'updateInterceptEndpointGroup', 'deleteInterceptEndpointGroup', 'listInterceptEndpointGroupAssociations', 'getInterceptEndpointGroupAssociation', 'createInterceptEndpointGroupAssociation', 'updateInterceptEndpointGroupAssociation', 'deleteInterceptEndpointGroupAssociation', 'listInterceptDeploymentGroups', 'getInterceptDeploymentGroup', 'createInterceptDeploymentGroup', 'updateInterceptDeploymentGroup', 'deleteInterceptDeploymentGroup', 'listInterceptDeployments', 'getInterceptDeployment', 'createInterceptDeployment', 'updateInterceptDeployment', 'deleteInterceptDeployment']; + const interceptStubMethods = [ + 'listInterceptEndpointGroups', + 'getInterceptEndpointGroup', + 'createInterceptEndpointGroup', + 'updateInterceptEndpointGroup', + 'deleteInterceptEndpointGroup', + 'listInterceptEndpointGroupAssociations', + 'getInterceptEndpointGroupAssociation', + 'createInterceptEndpointGroupAssociation', + 'updateInterceptEndpointGroupAssociation', + 'deleteInterceptEndpointGroupAssociation', + 'listInterceptDeploymentGroups', + 'getInterceptDeploymentGroup', + 'createInterceptDeploymentGroup', + 'updateInterceptDeploymentGroup', + 'deleteInterceptDeploymentGroup', + 'listInterceptDeployments', + 'getInterceptDeployment', + 'createInterceptDeployment', + 'updateInterceptDeployment', + 'deleteInterceptDeployment', + ]; for (const methodName of interceptStubMethods) { const callPromise = this.interceptStub.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) => () => { + (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] || @@ -491,7 +767,7 @@ export class InterceptClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -506,8 +782,14 @@ export class InterceptClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -518,8 +800,14 @@ export class InterceptClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -550,9 +838,7 @@ export class InterceptClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -561,8 +847,9 @@ export class InterceptClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -573,1883 +860,2932 @@ export class InterceptClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a specific endpoint group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint group to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group} - * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. - * 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/v1alpha1/intercept.get_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptEndpointGroup_async - */ + /** + * Gets a specific endpoint group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint group to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group} + * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. + * 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/v1alpha1/intercept.get_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptEndpointGroup_async + */ getInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptEndpointGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptEndpointGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptEndpointGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptEndpointGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific association. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the association to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association} - * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. - * 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/v1alpha1/intercept.get_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptEndpointGroupAssociation_async - */ + /** + * Gets a specific association. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the association to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association} + * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. + * 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/v1alpha1/intercept.get_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptEndpointGroupAssociation_async + */ getInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptEndpointGroupAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getInterceptEndpointGroupAssociation response %j', response); + this._log.info( + 'getInterceptEndpointGroupAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptEndpointGroupAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptEndpointGroupAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getInterceptEndpointGroupAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment group to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group} - * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. - * 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/v1alpha1/intercept.get_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptDeploymentGroup_async - */ + /** + * Gets a specific deployment group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment group to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group} + * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. + * 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/v1alpha1/intercept.get_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptDeploymentGroup_async + */ getInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptDeploymentGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptDeploymentGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptDeploymentGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptDeploymentGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: - * projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment} - * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. - * 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/v1alpha1/intercept.get_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptDeployment_async - */ + /** + * Gets a specific deployment. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: + * projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment} + * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. + * 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/v1alpha1/intercept.get_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_GetInterceptDeployment_async + */ getInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ] + >; getInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInterceptDeployment request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInterceptDeployment response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInterceptDeployment response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetInterceptDeploymentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getInterceptDeployment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an endpoint group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this endpoint group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptEndpointGroupId - * Required. The ID to use for the endpoint group, which will become the final - * component of the endpoint group's resource name. - * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup} request.interceptEndpointGroup - * Required. The endpoint group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.create_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroup_async - */ + /** + * Creates an endpoint group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this endpoint group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptEndpointGroupId + * Required. The ID to use for the endpoint group, which will become the final + * component of the endpoint group's resource name. + * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup} request.interceptEndpointGroup + * Required. The endpoint group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.create_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroup_async + */ createInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'createInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptEndpointGroup request %j', request); - return this.innerApiCalls.createInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptEndpointGroup()`. - * @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/v1alpha1/intercept.create_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroup_async - */ - async checkCreateInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptEndpointGroup()`. + * @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/v1alpha1/intercept.create_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroup_async + */ + async checkCreateInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates an endpoint group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the endpoint group - * (e.g. `description`; *not* `intercept_endpoint_group.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup} request.interceptEndpointGroup - * Required. The endpoint group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.update_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroup_async - */ + /** + * Updates an endpoint group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the endpoint group + * (e.g. `description`; *not* `intercept_endpoint_group.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup} request.interceptEndpointGroup + * Required. The endpoint group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.update_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroup_async + */ updateInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_endpoint_group.name': request.interceptEndpointGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_endpoint_group.name': + request.interceptEndpointGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'updateInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptEndpointGroup request %j', request); - return this.innerApiCalls.updateInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptEndpointGroup()`. - * @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/v1alpha1/intercept.update_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroup_async - */ - async checkUpdateInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptEndpointGroup()`. + * @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/v1alpha1/intercept.update_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroup_async + */ + async checkUpdateInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes an endpoint group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The endpoint group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.delete_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroup_async - */ + /** + * Deletes an endpoint group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The endpoint group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.delete_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroup_async + */ deleteInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptEndpointGroup response %j', rawResponse); + this._log.info( + 'deleteInterceptEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptEndpointGroup request %j', request); - return this.innerApiCalls.deleteInterceptEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptEndpointGroup()`. - * @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/v1alpha1/intercept.delete_intercept_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroup_async - */ - async checkDeleteInterceptEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptEndpointGroup()`. + * @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/v1alpha1/intercept.delete_intercept_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroup_async + */ + async checkDeleteInterceptEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteInterceptEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates an association in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this association will be created. - * Format: projects/{project}/locations/{location} - * @param {string} [request.interceptEndpointGroupAssociationId] - * Optional. The ID to use for the new association, which will become the - * final component of the endpoint group's resource name. If not provided, the - * server will generate a unique ID. - * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation - * Required. The association to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.create_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async - */ + /** + * Creates an association in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this association will be created. + * Format: projects/{project}/locations/{location} + * @param {string} [request.interceptEndpointGroupAssociationId] + * Optional. The ID to use for the new association, which will become the + * final component of the endpoint group's resource name. If not provided, the + * server will generate a unique ID. + * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation + * Required. The association to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.create_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async + */ createInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'createInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('createInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.createInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'createInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .createInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptEndpointGroupAssociation()`. - * @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/v1alpha1/intercept.create_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async - */ - async checkCreateInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptEndpointGroupAssociation()`. + * @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/v1alpha1/intercept.create_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptEndpointGroupAssociation_async + */ + async checkCreateInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates an association. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the association - * (e.g. `description`; *not* - * `intercept_endpoint_group_association.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation - * Required. The association to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.update_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async - */ + /** + * Updates an association. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the association + * (e.g. `description`; *not* + * `intercept_endpoint_group_association.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation} request.interceptEndpointGroupAssociation + * Required. The association to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.update_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async + */ updateInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_endpoint_group_association.name': request.interceptEndpointGroupAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_endpoint_group_association.name': + request.interceptEndpointGroupAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'updateInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('updateInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.updateInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'updateInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .updateInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptEndpointGroupAssociation()`. - * @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/v1alpha1/intercept.update_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async - */ - async checkUpdateInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptEndpointGroupAssociation()`. + * @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/v1alpha1/intercept.update_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptEndpointGroupAssociation_async + */ + async checkUpdateInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes an association. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The association to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.delete_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async - */ + /** + * Deletes an association. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The association to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.delete_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async + */ deleteInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'deleteInterceptEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('deleteInterceptEndpointGroupAssociation request %j', request); - return this.innerApiCalls.deleteInterceptEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'deleteInterceptEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .deleteInterceptEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptEndpointGroupAssociation()`. - * @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/v1alpha1/intercept.delete_intercept_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async - */ - async checkDeleteInterceptEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptEndpointGroupAssociation()`. + * @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/v1alpha1/intercept.delete_intercept_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptEndpointGroupAssociation_async + */ + async checkDeleteInterceptEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteInterceptEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a deployment group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptDeploymentGroupId - * Required. The ID to use for the new deployment group, which will become the - * final component of the deployment group's resource name. - * @param {google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup} request.interceptDeploymentGroup - * Required. The deployment group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.create_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeploymentGroup_async - */ + /** + * Creates a deployment group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptDeploymentGroupId + * Required. The ID to use for the new deployment group, which will become the + * final component of the deployment group's resource name. + * @param {google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup} request.interceptDeploymentGroup + * Required. The deployment group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.create_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeploymentGroup_async + */ createInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'createInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.createInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptDeploymentGroup()`. - * @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/v1alpha1/intercept.create_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeploymentGroup_async - */ - async checkCreateInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptDeploymentGroup()`. + * @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/v1alpha1/intercept.create_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeploymentGroup_async + */ + async checkCreateInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates a deployment group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment group - * (e.g. `description`; *not* - * `intercept_deployment_group.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup} request.interceptDeploymentGroup - * Required. The deployment group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.update_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeploymentGroup_async - */ + /** + * Updates a deployment group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment group + * (e.g. `description`; *not* + * `intercept_deployment_group.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup} request.interceptDeploymentGroup + * Required. The deployment group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.update_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeploymentGroup_async + */ updateInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_deployment_group.name': request.interceptDeploymentGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_deployment_group.name': + request.interceptDeploymentGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'updateInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.updateInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptDeploymentGroup()`. - * @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/v1alpha1/intercept.update_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeploymentGroup_async - */ - async checkUpdateInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptDeploymentGroup()`. + * @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/v1alpha1/intercept.update_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeploymentGroup_async + */ + async checkUpdateInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a deployment group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.delete_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeploymentGroup_async - */ + /** + * Deletes a deployment group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.delete_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeploymentGroup_async + */ deleteInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteInterceptDeploymentGroup response %j', rawResponse); + this._log.info( + 'deleteInterceptDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptDeploymentGroup request %j', request); - return this.innerApiCalls.deleteInterceptDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteInterceptDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptDeploymentGroup()`. - * @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/v1alpha1/intercept.delete_intercept_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeploymentGroup_async - */ - async checkDeleteInterceptDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptDeploymentGroup()`. + * @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/v1alpha1/intercept.delete_intercept_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeploymentGroup_async + */ + async checkDeleteInterceptDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteInterceptDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a deployment in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.interceptDeploymentId - * Required. The ID to use for the new deployment, which will become the final - * component of the deployment's resource name. - * @param {google.cloud.networksecurity.v1alpha1.InterceptDeployment} request.interceptDeployment - * Required. The deployment to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.create_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeployment_async - */ + /** + * Creates a deployment in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.interceptDeploymentId + * Required. The ID to use for the new deployment, which will become the final + * component of the deployment's resource name. + * @param {google.cloud.networksecurity.v1alpha1.InterceptDeployment} request.interceptDeployment + * Required. The deployment to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.create_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeployment_async + */ createInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createInterceptDeployment request %j', request); - return this.innerApiCalls.createInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createInterceptDeployment()`. - * @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/v1alpha1/intercept.create_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeployment_async - */ - async checkCreateInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createInterceptDeployment()`. + * @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/v1alpha1/intercept.create_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_CreateInterceptDeployment_async + */ + async checkCreateInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates a deployment. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment - * (e.g. `description`; *not* `intercept_deployment.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.InterceptDeployment} request.interceptDeployment - * Required. The deployment to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.update_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeployment_async - */ + /** + * Updates a deployment. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment + * (e.g. `description`; *not* `intercept_deployment.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.InterceptDeployment} request.interceptDeployment + * Required. The deployment to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.update_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeployment_async + */ updateInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'intercept_deployment.name': request.interceptDeployment!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'intercept_deployment.name': request.interceptDeployment!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateInterceptDeployment request %j', request); - return this.innerApiCalls.updateInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateInterceptDeployment()`. - * @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/v1alpha1/intercept.update_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeployment_async - */ - async checkUpdateInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateInterceptDeployment()`. + * @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/v1alpha1/intercept.update_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_UpdateInterceptDeployment_async + */ + async checkUpdateInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a deployment. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/intercept.delete_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeployment_async - */ + /** + * Deletes a deployment. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/intercept.delete_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeployment_async + */ deleteInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteInterceptDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteInterceptDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteInterceptDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteInterceptDeployment request %j', request); - return this.innerApiCalls.deleteInterceptDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInterceptDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteInterceptDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteInterceptDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteInterceptDeployment()`. - * @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/v1alpha1/intercept.delete_intercept_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeployment_async - */ - async checkDeleteInterceptDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteInterceptDeployment()`. + * @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/v1alpha1/intercept.delete_intercept_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_DeleteInterceptDeployment_async + */ + async checkDeleteInterceptDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteInterceptDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteInterceptDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists endpoint groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. - * 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 `listInterceptEndpointGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteInterceptDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists endpoint groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. + * 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 `listInterceptEndpointGroupsAsync()` + * 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. + */ listInterceptEndpointGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse, + ] + >; listInterceptEndpointGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup + >, + ): void; listInterceptEndpointGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup + >, + ): void; listInterceptEndpointGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptEndpointGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2458,468 +3794,540 @@ export class InterceptClient { this._log.info('listInterceptEndpointGroups request %j', request); return this.innerApiCalls .listInterceptEndpointGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse - ]) => { - this._log.info('listInterceptEndpointGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsResponse, + ]) => { + this._log.info('listInterceptEndpointGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptEndpointGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup} 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 `listInterceptEndpointGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptEndpointGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup} 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 `listInterceptEndpointGroupsAsync()` + * 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. + */ listInterceptEndpointGroupsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroups stream %j', request); return this.descriptors.page.listInterceptEndpointGroups.createStream( this.innerApiCalls.listInterceptEndpointGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptEndpointGroups`, 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, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. 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/v1alpha1/intercept.list_intercept_endpoint_groups.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptEndpointGroups_async - */ + /** + * Equivalent to `listInterceptEndpointGroups`, 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, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroup|InterceptEndpointGroup}. 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/v1alpha1/intercept.list_intercept_endpoint_groups.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptEndpointGroups_async + */ listInterceptEndpointGroupsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroups iterate %j', request); return this.descriptors.page.listInterceptEndpointGroups.asyncIterate( this.innerApiCalls['listInterceptEndpointGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists associations in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. - * 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 `listInterceptEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Lists associations in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. + * 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 `listInterceptEndpointGroupAssociationsAsync()` + * 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. + */ listInterceptEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse, + ] + >; listInterceptEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation + >, + ): void; listInterceptEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation + >, + ): void; listInterceptEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInterceptEndpointGroupAssociations values %j', values); + this._log.info( + 'listInterceptEndpointGroupAssociations values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listInterceptEndpointGroupAssociations request %j', request); + this._log.info( + 'listInterceptEndpointGroupAssociations request %j', + request, + ); return this.innerApiCalls .listInterceptEndpointGroupAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse - ]) => { - this._log.info('listInterceptEndpointGroupAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsResponse, + ]) => { + this._log.info( + 'listInterceptEndpointGroupAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptEndpointGroupAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation} 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 `listInterceptEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptEndpointGroupAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation} 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 `listInterceptEndpointGroupAssociationsAsync()` + * 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. + */ listInterceptEndpointGroupAssociationsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + 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['listInterceptEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listInterceptEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptEndpointGroupAssociations stream %j', request); return this.descriptors.page.listInterceptEndpointGroupAssociations.createStream( this.innerApiCalls.listInterceptEndpointGroupAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptEndpointGroupAssociations`, 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, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListInterceptEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. 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/v1alpha1/intercept.list_intercept_endpoint_group_associations.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptEndpointGroupAssociations_async - */ + /** + * Equivalent to `listInterceptEndpointGroupAssociations`, 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, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListInterceptEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptEndpointGroupAssociation|InterceptEndpointGroupAssociation}. 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/v1alpha1/intercept.list_intercept_endpoint_group_associations.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptEndpointGroupAssociations_async + */ listInterceptEndpointGroupAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptEndpointGroupAssociationsRequest, + 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['listInterceptEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listInterceptEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInterceptEndpointGroupAssociations iterate %j', request); + this.initialize().catch((err) => { + throw err; + }); + this._log.info( + 'listInterceptEndpointGroupAssociations iterate %j', + request, + ); return this.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate( this.innerApiCalls['listInterceptEndpointGroupAssociations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployment groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. - * 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 `listInterceptDeploymentGroupsAsync()` - * 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. - */ + /** + * Lists deployment groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. + * 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 `listInterceptDeploymentGroupsAsync()` + * 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. + */ listInterceptDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse, + ] + >; listInterceptDeploymentGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup + >, + ): void; listInterceptDeploymentGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup + >, + ): void; listInterceptDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptDeploymentGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2928,232 +4336,261 @@ export class InterceptClient { this._log.info('listInterceptDeploymentGroups request %j', request); return this.innerApiCalls .listInterceptDeploymentGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse - ]) => { - this._log.info('listInterceptDeploymentGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsResponse, + ]) => { + this._log.info('listInterceptDeploymentGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptDeploymentGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup} 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 `listInterceptDeploymentGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptDeploymentGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup} 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 `listInterceptDeploymentGroupsAsync()` + * 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. + */ listInterceptDeploymentGroupsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeploymentGroups stream %j', request); return this.descriptors.page.listInterceptDeploymentGroups.createStream( this.innerApiCalls.listInterceptDeploymentGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptDeploymentGroups`, 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, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListInterceptDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListInterceptDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. 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/v1alpha1/intercept.list_intercept_deployment_groups.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptDeploymentGroups_async - */ + /** + * Equivalent to `listInterceptDeploymentGroups`, 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, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListInterceptDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListInterceptDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeploymentGroup|InterceptDeploymentGroup}. 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/v1alpha1/intercept.list_intercept_deployment_groups.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptDeploymentGroups_async + */ listInterceptDeploymentGroupsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeploymentGroups iterate %j', request); return this.descriptors.page.listInterceptDeploymentGroups.asyncIterate( this.innerApiCalls['listInterceptDeploymentGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployments in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. - * 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 `listInterceptDeploymentsAsync()` - * 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. - */ + /** + * Lists deployments in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. + * 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 `listInterceptDeploymentsAsync()` + * 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. + */ listInterceptDeployments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse, + ] + >; listInterceptDeployments( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment + >, + ): void; listInterceptDeployments( - request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment + >, + ): void; listInterceptDeployments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInterceptDeployments values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3162,161 +4599,165 @@ export class InterceptClient { this._log.info('listInterceptDeployments request %j', request); return this.innerApiCalls .listInterceptDeployments(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse - ]) => { - this._log.info('listInterceptDeployments values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsResponse, + ]) => { + this._log.info('listInterceptDeployments values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInterceptDeployments`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment} 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 `listInterceptDeploymentsAsync()` - * 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. - */ + /** + * Equivalent to `listInterceptDeployments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment} 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 `listInterceptDeploymentsAsync()` + * 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. + */ listInterceptDeploymentsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeployments stream %j', request); return this.descriptors.page.listInterceptDeployments.createStream( this.innerApiCalls.listInterceptDeployments as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInterceptDeployments`, 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, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListInterceptDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListInterceptDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. 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/v1alpha1/intercept.list_intercept_deployments.js - * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptDeployments_async - */ + /** + * Equivalent to `listInterceptDeployments`, 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, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListInterceptDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListInterceptDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.InterceptDeployment|InterceptDeployment}. 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/v1alpha1/intercept.list_intercept_deployments.js + * region_tag:networksecurity_v1alpha1_generated_Intercept_ListInterceptDeployments_async + */ listInterceptDeploymentsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListInterceptDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInterceptDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInterceptDeployments iterate %j', request); return this.descriptors.page.listInterceptDeployments.asyncIterate( this.innerApiCalls['listInterceptDeployments'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -3330,40 +4771,40 @@ export class InterceptClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -3377,41 +4818,41 @@ export class InterceptClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -3425,12 +4866,12 @@ export class InterceptClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3465,12 +4906,11 @@ export class InterceptClient { | 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. @@ -3503,12 +4943,12 @@ export class InterceptClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -3551,22 +4991,22 @@ export class InterceptClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3601,15 +5041,15 @@ export class InterceptClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3643,7 +5083,7 @@ export class InterceptClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3656,25 +5096,24 @@ export class InterceptClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -3713,22 +5152,22 @@ export class InterceptClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -3744,7 +5183,11 @@ export class InterceptClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -3760,7 +5203,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -3771,7 +5216,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -3781,8 +5228,12 @@ export class InterceptClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -3793,7 +5244,7 @@ export class InterceptClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -3809,7 +5260,8 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -3820,7 +5272,8 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -3831,7 +5284,8 @@ export class InterceptClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -3842,7 +5296,11 @@ export class InterceptClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -3857,8 +5315,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -3868,8 +5330,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -3879,8 +5345,12 @@ export class InterceptClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -3891,7 +5361,11 @@ export class InterceptClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3907,7 +5381,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -3918,7 +5394,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -3929,7 +5407,9 @@ export class InterceptClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -3940,7 +5420,11 @@ export class InterceptClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -3956,7 +5440,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -3967,7 +5453,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -3977,8 +5465,12 @@ export class InterceptClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -3989,7 +5481,11 @@ export class InterceptClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -4004,8 +5500,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -4015,8 +5515,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -4026,8 +5530,12 @@ export class InterceptClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -4037,7 +5545,7 @@ export class InterceptClient { * @param {string} forwarding_rule * @returns {string} Resource name string. */ - forwardingRulePath(project:string,forwardingRule:string) { + forwardingRulePath(project: string, forwardingRule: string) { return this.pathTemplates.forwardingRulePathTemplate.render({ project: project, forwarding_rule: forwardingRule, @@ -4052,7 +5560,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).project; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).project; } /** @@ -4063,7 +5573,9 @@ export class InterceptClient { * @returns {string} A string representing the forwarding_rule. */ matchForwardingRuleFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).forwarding_rule; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).forwarding_rule; } /** @@ -4074,7 +5586,11 @@ export class InterceptClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -4090,7 +5606,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -4100,8 +5618,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -4111,8 +5633,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -4124,7 +5650,12 @@ export class InterceptClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -4140,8 +5671,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -4151,8 +5686,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -4162,8 +5701,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -4173,8 +5716,12 @@ export class InterceptClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -4185,7 +5732,11 @@ export class InterceptClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -4201,7 +5752,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -4212,7 +5765,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -4222,8 +5777,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -4234,7 +5793,11 @@ export class InterceptClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4249,8 +5812,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -4260,8 +5827,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -4271,8 +5842,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -4283,7 +5858,11 @@ export class InterceptClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4298,8 +5877,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -4309,8 +5892,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -4320,8 +5907,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -4332,12 +5923,18 @@ export class InterceptClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -4347,8 +5944,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -4358,8 +5959,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -4369,8 +5974,12 @@ export class InterceptClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -4380,7 +5989,7 @@ export class InterceptClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4417,7 +6026,11 @@ export class InterceptClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -4433,7 +6046,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -4444,7 +6059,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -4454,8 +6071,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -4466,7 +6087,11 @@ export class InterceptClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4481,8 +6106,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -4492,8 +6121,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -4503,8 +6136,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -4515,7 +6152,11 @@ export class InterceptClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4530,8 +6171,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -4541,8 +6186,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -4552,8 +6201,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -4564,12 +6217,18 @@ export class InterceptClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -4579,8 +6238,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -4590,8 +6253,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -4601,8 +6268,12 @@ export class InterceptClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -4612,7 +6283,7 @@ export class InterceptClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -4649,12 +6320,18 @@ export class InterceptClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4664,8 +6341,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -4675,8 +6356,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -4686,8 +6371,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4698,12 +6387,18 @@ export class InterceptClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4713,8 +6408,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -4724,8 +6423,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -4735,8 +6438,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -4747,12 +6454,18 @@ export class InterceptClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -4762,8 +6475,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -4773,8 +6490,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -4784,8 +6505,12 @@ export class InterceptClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -4796,7 +6521,11 @@ export class InterceptClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -4812,7 +6541,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -4823,7 +6554,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -4833,8 +6566,12 @@ export class InterceptClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -4845,7 +6582,11 @@ export class InterceptClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -4861,7 +6602,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -4872,7 +6615,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -4883,7 +6628,9 @@ export class InterceptClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -4892,7 +6639,7 @@ export class InterceptClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -4917,12 +6664,18 @@ export class InterceptClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4932,8 +6685,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -4943,8 +6700,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -4954,8 +6715,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4966,12 +6731,18 @@ export class InterceptClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4981,8 +6752,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -4992,8 +6767,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -5003,8 +6782,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -5015,12 +6798,18 @@ export class InterceptClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -5030,8 +6819,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -5041,8 +6834,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -5052,8 +6849,12 @@ export class InterceptClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -5064,7 +6865,7 @@ export class InterceptClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -5080,7 +6881,8 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -5091,7 +6893,8 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -5102,7 +6905,8 @@ export class InterceptClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -5113,7 +6917,7 @@ export class InterceptClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -5151,7 +6955,8 @@ export class InterceptClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -5162,7 +6967,11 @@ export class InterceptClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -5178,7 +6987,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -5189,7 +7000,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -5199,8 +7012,12 @@ export class InterceptClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -5211,7 +7028,11 @@ export class InterceptClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -5227,7 +7048,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -5238,7 +7061,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -5249,7 +7074,9 @@ export class InterceptClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -5260,7 +7087,11 @@ export class InterceptClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -5276,7 +7107,9 @@ export class InterceptClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -5287,7 +7120,9 @@ export class InterceptClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -5297,8 +7132,12 @@ export class InterceptClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -5309,7 +7148,7 @@ export class InterceptClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -5358,15 +7197,19 @@ export class InterceptClient { */ close(): Promise { if (this.interceptStub && !this._terminated) { - return this.interceptStub.then(stub => { + return this.interceptStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/mirroring_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/mirroring_client.ts index 9a171efa9519..b44135e988e4 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/mirroring_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/mirroring_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class MirroringClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class MirroringClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - mirroringStub?: Promise<{[name: string]: Function}>; + mirroringStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of MirroringClient. @@ -103,21 +116,42 @@ export class MirroringClient { * const client = new MirroringClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof MirroringClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class MirroringClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class MirroringClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,106 +218,114 @@ export class MirroringClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), forwardingRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/forwardingRules/{forwarding_rule}' + 'projects/{project}/global/forwardingRules/{forwarding_rule}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/global/networks/{network}', ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -295,14 +333,27 @@ export class MirroringClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listMirroringEndpointGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringEndpointGroups'), + listMirroringEndpointGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringEndpointGroups', + ), listMirroringEndpointGroupAssociations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringEndpointGroupAssociations'), - listMirroringDeploymentGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringDeploymentGroups'), - listMirroringDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mirroringDeployments') + new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringEndpointGroupAssociations', + ), + listMirroringDeploymentGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringDeploymentGroups', + ), + listMirroringDeployments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'mirroringDeployments', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -311,124 +362,323 @@ export class MirroringClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup', + ) as gax.protobuf.Type; const createMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup', + ) as gax.protobuf.Type; const updateMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringEndpointGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringEndpointGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation') as gax.protobuf.Type; - const createMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation') as gax.protobuf.Type; - const updateMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteMirroringEndpointGroupAssociationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteMirroringEndpointGroupAssociationMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const createMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation', + ) as gax.protobuf.Type; + const createMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const updateMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation', + ) as gax.protobuf.Type; + const updateMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteMirroringEndpointGroupAssociationResponse = + protoFilesRoot.lookup('.google.protobuf.Empty') as gax.protobuf.Type; + const deleteMirroringEndpointGroupAssociationMetadata = + protoFilesRoot.lookup( + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup', + ) as gax.protobuf.Type; const createMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup', + ) as gax.protobuf.Type; const updateMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringDeploymentGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringDeploymentGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringDeployment', + ) as gax.protobuf.Type; const createMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.MirroringDeployment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.MirroringDeployment', + ) as gax.protobuf.Type; const updateMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMirroringDeploymentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMirroringDeploymentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringEndpointGroupResponse.decode.bind(createMirroringEndpointGroupResponse), - createMirroringEndpointGroupMetadata.decode.bind(createMirroringEndpointGroupMetadata)), + createMirroringEndpointGroupResponse.decode.bind( + createMirroringEndpointGroupResponse, + ), + createMirroringEndpointGroupMetadata.decode.bind( + createMirroringEndpointGroupMetadata, + ), + ), updateMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringEndpointGroupResponse.decode.bind(updateMirroringEndpointGroupResponse), - updateMirroringEndpointGroupMetadata.decode.bind(updateMirroringEndpointGroupMetadata)), + updateMirroringEndpointGroupResponse.decode.bind( + updateMirroringEndpointGroupResponse, + ), + updateMirroringEndpointGroupMetadata.decode.bind( + updateMirroringEndpointGroupMetadata, + ), + ), deleteMirroringEndpointGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringEndpointGroupResponse.decode.bind(deleteMirroringEndpointGroupResponse), - deleteMirroringEndpointGroupMetadata.decode.bind(deleteMirroringEndpointGroupMetadata)), - createMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMirroringEndpointGroupAssociationResponse.decode.bind(createMirroringEndpointGroupAssociationResponse), - createMirroringEndpointGroupAssociationMetadata.decode.bind(createMirroringEndpointGroupAssociationMetadata)), - updateMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMirroringEndpointGroupAssociationResponse.decode.bind(updateMirroringEndpointGroupAssociationResponse), - updateMirroringEndpointGroupAssociationMetadata.decode.bind(updateMirroringEndpointGroupAssociationMetadata)), - deleteMirroringEndpointGroupAssociation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteMirroringEndpointGroupAssociationResponse.decode.bind(deleteMirroringEndpointGroupAssociationResponse), - deleteMirroringEndpointGroupAssociationMetadata.decode.bind(deleteMirroringEndpointGroupAssociationMetadata)), + deleteMirroringEndpointGroupResponse.decode.bind( + deleteMirroringEndpointGroupResponse, + ), + deleteMirroringEndpointGroupMetadata.decode.bind( + deleteMirroringEndpointGroupMetadata, + ), + ), + createMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMirroringEndpointGroupAssociationResponse.decode.bind( + createMirroringEndpointGroupAssociationResponse, + ), + createMirroringEndpointGroupAssociationMetadata.decode.bind( + createMirroringEndpointGroupAssociationMetadata, + ), + ), + updateMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMirroringEndpointGroupAssociationResponse.decode.bind( + updateMirroringEndpointGroupAssociationResponse, + ), + updateMirroringEndpointGroupAssociationMetadata.decode.bind( + updateMirroringEndpointGroupAssociationMetadata, + ), + ), + deleteMirroringEndpointGroupAssociation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteMirroringEndpointGroupAssociationResponse.decode.bind( + deleteMirroringEndpointGroupAssociationResponse, + ), + deleteMirroringEndpointGroupAssociationMetadata.decode.bind( + deleteMirroringEndpointGroupAssociationMetadata, + ), + ), createMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringDeploymentGroupResponse.decode.bind(createMirroringDeploymentGroupResponse), - createMirroringDeploymentGroupMetadata.decode.bind(createMirroringDeploymentGroupMetadata)), + createMirroringDeploymentGroupResponse.decode.bind( + createMirroringDeploymentGroupResponse, + ), + createMirroringDeploymentGroupMetadata.decode.bind( + createMirroringDeploymentGroupMetadata, + ), + ), updateMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringDeploymentGroupResponse.decode.bind(updateMirroringDeploymentGroupResponse), - updateMirroringDeploymentGroupMetadata.decode.bind(updateMirroringDeploymentGroupMetadata)), + updateMirroringDeploymentGroupResponse.decode.bind( + updateMirroringDeploymentGroupResponse, + ), + updateMirroringDeploymentGroupMetadata.decode.bind( + updateMirroringDeploymentGroupMetadata, + ), + ), deleteMirroringDeploymentGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringDeploymentGroupResponse.decode.bind(deleteMirroringDeploymentGroupResponse), - deleteMirroringDeploymentGroupMetadata.decode.bind(deleteMirroringDeploymentGroupMetadata)), + deleteMirroringDeploymentGroupResponse.decode.bind( + deleteMirroringDeploymentGroupResponse, + ), + deleteMirroringDeploymentGroupMetadata.decode.bind( + deleteMirroringDeploymentGroupMetadata, + ), + ), createMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createMirroringDeploymentResponse.decode.bind(createMirroringDeploymentResponse), - createMirroringDeploymentMetadata.decode.bind(createMirroringDeploymentMetadata)), + createMirroringDeploymentResponse.decode.bind( + createMirroringDeploymentResponse, + ), + createMirroringDeploymentMetadata.decode.bind( + createMirroringDeploymentMetadata, + ), + ), updateMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateMirroringDeploymentResponse.decode.bind(updateMirroringDeploymentResponse), - updateMirroringDeploymentMetadata.decode.bind(updateMirroringDeploymentMetadata)), + updateMirroringDeploymentResponse.decode.bind( + updateMirroringDeploymentResponse, + ), + updateMirroringDeploymentMetadata.decode.bind( + updateMirroringDeploymentMetadata, + ), + ), deleteMirroringDeployment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteMirroringDeploymentResponse.decode.bind(deleteMirroringDeploymentResponse), - deleteMirroringDeploymentMetadata.decode.bind(deleteMirroringDeploymentMetadata)) + deleteMirroringDeploymentResponse.decode.bind( + deleteMirroringDeploymentResponse, + ), + deleteMirroringDeploymentMetadata.decode.bind( + deleteMirroringDeploymentMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.Mirroring', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.Mirroring', + 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 @@ -459,28 +709,54 @@ export class MirroringClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.Mirroring. this.mirroringStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.Mirroring') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.Mirroring', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.networksecurity.v1alpha1.Mirroring, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + 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 mirroringStubMethods = - ['listMirroringEndpointGroups', 'getMirroringEndpointGroup', 'createMirroringEndpointGroup', 'updateMirroringEndpointGroup', 'deleteMirroringEndpointGroup', 'listMirroringEndpointGroupAssociations', 'getMirroringEndpointGroupAssociation', 'createMirroringEndpointGroupAssociation', 'updateMirroringEndpointGroupAssociation', 'deleteMirroringEndpointGroupAssociation', 'listMirroringDeploymentGroups', 'getMirroringDeploymentGroup', 'createMirroringDeploymentGroup', 'updateMirroringDeploymentGroup', 'deleteMirroringDeploymentGroup', 'listMirroringDeployments', 'getMirroringDeployment', 'createMirroringDeployment', 'updateMirroringDeployment', 'deleteMirroringDeployment']; + const mirroringStubMethods = [ + 'listMirroringEndpointGroups', + 'getMirroringEndpointGroup', + 'createMirroringEndpointGroup', + 'updateMirroringEndpointGroup', + 'deleteMirroringEndpointGroup', + 'listMirroringEndpointGroupAssociations', + 'getMirroringEndpointGroupAssociation', + 'createMirroringEndpointGroupAssociation', + 'updateMirroringEndpointGroupAssociation', + 'deleteMirroringEndpointGroupAssociation', + 'listMirroringDeploymentGroups', + 'getMirroringDeploymentGroup', + 'createMirroringDeploymentGroup', + 'updateMirroringDeploymentGroup', + 'deleteMirroringDeploymentGroup', + 'listMirroringDeployments', + 'getMirroringDeployment', + 'createMirroringDeployment', + 'updateMirroringDeployment', + 'deleteMirroringDeployment', + ]; for (const methodName of mirroringStubMethods) { const callPromise = this.mirroringStub.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) => () => { + (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] || @@ -490,7 +766,7 @@ export class MirroringClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -505,8 +781,14 @@ export class MirroringClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -517,8 +799,14 @@ export class MirroringClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -549,9 +837,7 @@ export class MirroringClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -560,8 +846,9 @@ export class MirroringClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -572,1883 +859,2932 @@ export class MirroringClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a specific endpoint group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the endpoint group to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group} - * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. - * 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/v1alpha1/mirroring.get_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringEndpointGroup_async - */ + /** + * Gets a specific endpoint group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the endpoint group to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group} + * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. + * 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/v1alpha1/mirroring.get_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringEndpointGroup_async + */ getMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringEndpointGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringEndpointGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringEndpointGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringEndpointGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific association. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the association to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association} - * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. - * 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/v1alpha1/mirroring.get_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringEndpointGroupAssociation_async - */ + /** + * Gets a specific association. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the association to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association} + * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. + * 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/v1alpha1/mirroring.get_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringEndpointGroupAssociation_async + */ getMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringEndpointGroupAssociation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getMirroringEndpointGroupAssociation response %j', response); + this._log.info( + 'getMirroringEndpointGroupAssociation response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringEndpointGroupAssociation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringEndpointGroupAssociation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringEndpointGroupAssociationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getMirroringEndpointGroupAssociation response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment group. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment group to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group} - * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. - * 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/v1alpha1/mirroring.get_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringDeploymentGroup_async - */ + /** + * Gets a specific deployment group. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment group to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group} + * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. + * 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/v1alpha1/mirroring.get_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringDeploymentGroup_async + */ getMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringDeploymentGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringDeploymentGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringDeploymentGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringDeploymentGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a specific deployment. - * See https://google.aip.dev/131. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: - * projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment} - * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. - * 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/v1alpha1/mirroring.get_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringDeployment_async - */ + /** + * Gets a specific deployment. + * See https://google.aip.dev/131. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: + * projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment} + * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. + * 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/v1alpha1/mirroring.get_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_GetMirroringDeployment_async + */ getMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ] + >; getMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMirroringDeployment request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMirroringDeployment response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, - protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMirroringDeployment response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetMirroringDeploymentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getMirroringDeployment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an endpoint group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this endpoint group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringEndpointGroupId - * Required. The ID to use for the endpoint group, which will become the final - * component of the endpoint group's resource name. - * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup} request.mirroringEndpointGroup - * Required. The endpoint group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.create_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroup_async - */ + /** + * Creates an endpoint group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this endpoint group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringEndpointGroupId + * Required. The ID to use for the endpoint group, which will become the final + * component of the endpoint group's resource name. + * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup} request.mirroringEndpointGroup + * Required. The endpoint group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.create_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroup_async + */ createMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'createMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringEndpointGroup request %j', request); - return this.innerApiCalls.createMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringEndpointGroup()`. - * @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/v1alpha1/mirroring.create_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroup_async - */ - async checkCreateMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringEndpointGroup()`. + * @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/v1alpha1/mirroring.create_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroup_async + */ + async checkCreateMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates an endpoint group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the endpoint group - * (e.g. `description`; *not* `mirroring_endpoint_group.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup} request.mirroringEndpointGroup - * Required. The endpoint group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.update_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroup_async - */ + /** + * Updates an endpoint group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the endpoint group + * (e.g. `description`; *not* `mirroring_endpoint_group.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup} request.mirroringEndpointGroup + * Required. The endpoint group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.update_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroup_async + */ updateMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_endpoint_group.name': request.mirroringEndpointGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_endpoint_group.name': + request.mirroringEndpointGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'updateMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringEndpointGroup request %j', request); - return this.innerApiCalls.updateMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringEndpointGroup()`. - * @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/v1alpha1/mirroring.update_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroup_async - */ - async checkUpdateMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringEndpointGroup()`. + * @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/v1alpha1/mirroring.update_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroup_async + */ + async checkUpdateMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes an endpoint group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The endpoint group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroup_async - */ + /** + * Deletes an endpoint group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The endpoint group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroup_async + */ deleteMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringEndpointGroup response %j', rawResponse); + this._log.info( + 'deleteMirroringEndpointGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringEndpointGroup request %j', request); - return this.innerApiCalls.deleteMirroringEndpointGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringEndpointGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringEndpointGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringEndpointGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringEndpointGroup()`. - * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroup_async - */ - async checkDeleteMirroringEndpointGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringEndpointGroup()`. + * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroup_async + */ + async checkDeleteMirroringEndpointGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteMirroringEndpointGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringEndpointGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringEndpointGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates an association in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this association will be created. - * Format: projects/{project}/locations/{location} - * @param {string} [request.mirroringEndpointGroupAssociationId] - * Optional. The ID to use for the new association, which will become the - * final component of the endpoint group's resource name. If not provided, the - * server will generate a unique ID. - * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation - * Required. The association to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.create_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async - */ + /** + * Creates an association in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this association will be created. + * Format: projects/{project}/locations/{location} + * @param {string} [request.mirroringEndpointGroupAssociationId] + * Optional. The ID to use for the new association, which will become the + * final component of the endpoint group's resource name. If not provided, the + * server will generate a unique ID. + * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation + * Required. The association to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.create_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async + */ createMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'createMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('createMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.createMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'createMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .createMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringEndpointGroupAssociation()`. - * @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/v1alpha1/mirroring.create_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async - */ - async checkCreateMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringEndpointGroupAssociation()`. + * @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/v1alpha1/mirroring.create_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringEndpointGroupAssociation_async + */ + async checkCreateMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates an association. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the association - * (e.g. `description`; *not* - * `mirroring_endpoint_group_association.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation - * Required. The association to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.update_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async - */ + /** + * Updates an association. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the association + * (e.g. `description`; *not* + * `mirroring_endpoint_group_association.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation} request.mirroringEndpointGroupAssociation + * Required. The association to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.update_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async + */ updateMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_endpoint_group_association.name': request.mirroringEndpointGroupAssociation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_endpoint_group_association.name': + request.mirroringEndpointGroupAssociation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'updateMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('updateMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.updateMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'updateMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .updateMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringEndpointGroupAssociation()`. - * @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/v1alpha1/mirroring.update_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async - */ - async checkUpdateMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringEndpointGroupAssociation()`. + * @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/v1alpha1/mirroring.update_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringEndpointGroupAssociation_async + */ + async checkUpdateMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes an association. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The association to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async - */ + /** + * Deletes an association. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The association to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async + */ deleteMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroupAssociation( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringEndpointGroupAssociation( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringEndpointGroupAssociationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringEndpointGroupAssociation response %j', rawResponse); + this._log.info( + 'deleteMirroringEndpointGroupAssociation response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; - this._log.info('deleteMirroringEndpointGroupAssociation request %j', request); - return this.innerApiCalls.deleteMirroringEndpointGroupAssociation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringEndpointGroupAssociation response %j', rawResponse); - return [response, rawResponse, _]; - }); + this._log.info( + 'deleteMirroringEndpointGroupAssociation request %j', + request, + ); + return this.innerApiCalls + .deleteMirroringEndpointGroupAssociation( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringEndpointGroupAssociation response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringEndpointGroupAssociation()`. - * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group_association.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async - */ - async checkDeleteMirroringEndpointGroupAssociationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringEndpointGroupAssociation()`. + * @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/v1alpha1/mirroring.delete_mirroring_endpoint_group_association.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringEndpointGroupAssociation_async + */ + async checkDeleteMirroringEndpointGroupAssociationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteMirroringEndpointGroupAssociation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringEndpointGroupAssociation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringEndpointGroupAssociation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a deployment group in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment group will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringDeploymentGroupId - * Required. The ID to use for the new deployment group, which will become the - * final component of the deployment group's resource name. - * @param {google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup} request.mirroringDeploymentGroup - * Required. The deployment group to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.create_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeploymentGroup_async - */ + /** + * Creates a deployment group in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment group will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringDeploymentGroupId + * Required. The ID to use for the new deployment group, which will become the + * final component of the deployment group's resource name. + * @param {google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup} request.mirroringDeploymentGroup + * Required. The deployment group to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.create_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeploymentGroup_async + */ createMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'createMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.createMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringDeploymentGroup()`. - * @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/v1alpha1/mirroring.create_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeploymentGroup_async - */ - async checkCreateMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringDeploymentGroup()`. + * @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/v1alpha1/mirroring.create_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeploymentGroup_async + */ + async checkCreateMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates a deployment group. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment group - * (e.g. `description`; *not* - * `mirroring_deployment_group.description`). See - * https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup} request.mirroringDeploymentGroup - * Required. The deployment group to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.update_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeploymentGroup_async - */ + /** + * Updates a deployment group. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment group + * (e.g. `description`; *not* + * `mirroring_deployment_group.description`). See + * https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup} request.mirroringDeploymentGroup + * Required. The deployment group to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.update_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeploymentGroup_async + */ updateMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_deployment_group.name': request.mirroringDeploymentGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_deployment_group.name': + request.mirroringDeploymentGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'updateMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.updateMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringDeploymentGroup()`. - * @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/v1alpha1/mirroring.update_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeploymentGroup_async - */ - async checkUpdateMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringDeploymentGroup()`. + * @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/v1alpha1/mirroring.update_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeploymentGroup_async + */ + async checkUpdateMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a deployment group. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment group to delete. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.delete_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeploymentGroup_async - */ + /** + * Deletes a deployment group. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment group to delete. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.delete_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeploymentGroup_async + */ deleteMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeploymentGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeploymentGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteMirroringDeploymentGroup response %j', rawResponse); + this._log.info( + 'deleteMirroringDeploymentGroup response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringDeploymentGroup request %j', request); - return this.innerApiCalls.deleteMirroringDeploymentGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringDeploymentGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringDeploymentGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteMirroringDeploymentGroup response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringDeploymentGroup()`. - * @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/v1alpha1/mirroring.delete_mirroring_deployment_group.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeploymentGroup_async - */ - async checkDeleteMirroringDeploymentGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringDeploymentGroup()`. + * @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/v1alpha1/mirroring.delete_mirroring_deployment_group.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeploymentGroup_async + */ + async checkDeleteMirroringDeploymentGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteMirroringDeploymentGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringDeploymentGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringDeploymentGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a deployment in a given project and location. - * See https://google.aip.dev/133. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this deployment will be created. - * Format: projects/{project}/locations/{location} - * @param {string} request.mirroringDeploymentId - * Required. The ID to use for the new deployment, which will become the final - * component of the deployment's resource name. - * @param {google.cloud.networksecurity.v1alpha1.MirroringDeployment} request.mirroringDeployment - * Required. The deployment to create. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.create_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeployment_async - */ + /** + * Creates a deployment in a given project and location. + * See https://google.aip.dev/133. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this deployment will be created. + * Format: projects/{project}/locations/{location} + * @param {string} request.mirroringDeploymentId + * Required. The ID to use for the new deployment, which will become the final + * component of the deployment's resource name. + * @param {google.cloud.networksecurity.v1alpha1.MirroringDeployment} request.mirroringDeployment + * Required. The deployment to create. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.create_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeployment_async + */ createMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMirroringDeployment request %j', request); - return this.innerApiCalls.createMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMirroringDeployment()`. - * @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/v1alpha1/mirroring.create_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeployment_async - */ - async checkCreateMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMirroringDeployment()`. + * @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/v1alpha1/mirroring.create_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_CreateMirroringDeployment_async + */ + async checkCreateMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates a deployment. - * See https://google.aip.dev/134. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to update. - * Fields are specified relative to the deployment - * (e.g. `description`; *not* `mirroring_deployment.description`). - * See https://google.aip.dev/161 for more details. - * @param {google.cloud.networksecurity.v1alpha1.MirroringDeployment} request.mirroringDeployment - * Required. The deployment to update. - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.update_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeployment_async - */ + /** + * Updates a deployment. + * See https://google.aip.dev/134. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * Fields are specified relative to the deployment + * (e.g. `description`; *not* `mirroring_deployment.description`). + * See https://google.aip.dev/161 for more details. + * @param {google.cloud.networksecurity.v1alpha1.MirroringDeployment} request.mirroringDeployment + * Required. The deployment to update. + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.update_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeployment_async + */ updateMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'mirroring_deployment.name': request.mirroringDeployment!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'mirroring_deployment.name': request.mirroringDeployment!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMirroringDeployment request %j', request); - return this.innerApiCalls.updateMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMirroringDeployment()`. - * @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/v1alpha1/mirroring.update_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeployment_async - */ - async checkUpdateMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMirroringDeployment()`. + * @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/v1alpha1/mirroring.update_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_UpdateMirroringDeployment_async + */ + async checkUpdateMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a deployment. - * See https://google.aip.dev/135. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. A unique identifier for this request. Must be a UUID4. - * This request is only idempotent if a `request_id` is provided. - * See https://google.aip.dev/155 for more details. - * @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/v1alpha1/mirroring.delete_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeployment_async - */ + /** + * Deletes a deployment. + * See https://google.aip.dev/135. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. A unique identifier for this request. Must be a UUID4. + * This request is only idempotent if a `request_id` is provided. + * See https://google.aip.dev/155 for more details. + * @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/v1alpha1/mirroring.delete_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeployment_async + */ deleteMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeployment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMirroringDeployment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteMirroringDeploymentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteMirroringDeployment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMirroringDeployment request %j', request); - return this.innerApiCalls.deleteMirroringDeployment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMirroringDeployment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMirroringDeployment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteMirroringDeployment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMirroringDeployment()`. - * @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/v1alpha1/mirroring.delete_mirroring_deployment.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeployment_async - */ - async checkDeleteMirroringDeploymentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMirroringDeployment()`. + * @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/v1alpha1/mirroring.delete_mirroring_deployment.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_DeleteMirroringDeployment_async + */ + async checkDeleteMirroringDeploymentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteMirroringDeployment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteMirroringDeployment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists endpoint groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. - * 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 `listMirroringEndpointGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMirroringDeployment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists endpoint groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. + * 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 `listMirroringEndpointGroupsAsync()` + * 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. + */ listMirroringEndpointGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse, + ] + >; listMirroringEndpointGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup + >, + ): void; listMirroringEndpointGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup + >, + ): void; listMirroringEndpointGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringEndpointGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2457,468 +3793,540 @@ export class MirroringClient { this._log.info('listMirroringEndpointGroups request %j', request); return this.innerApiCalls .listMirroringEndpointGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse - ]) => { - this._log.info('listMirroringEndpointGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsResponse, + ]) => { + this._log.info('listMirroringEndpointGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringEndpointGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup} 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 `listMirroringEndpointGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringEndpointGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup} 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 `listMirroringEndpointGroupsAsync()` + * 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. + */ listMirroringEndpointGroupsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroups stream %j', request); return this.descriptors.page.listMirroringEndpointGroups.createStream( this.innerApiCalls.listMirroringEndpointGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringEndpointGroups`, 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, which owns this collection of endpoint groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. - * See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. 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/v1alpha1/mirroring.list_mirroring_endpoint_groups.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringEndpointGroups_async - */ + /** + * Equivalent to `listMirroringEndpointGroups`, 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, which owns this collection of endpoint groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. + * See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroup|MirroringEndpointGroup}. 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/v1alpha1/mirroring.list_mirroring_endpoint_groups.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringEndpointGroups_async + */ listMirroringEndpointGroupsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringEndpointGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroups iterate %j', request); return this.descriptors.page.listMirroringEndpointGroups.asyncIterate( this.innerApiCalls['listMirroringEndpointGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists associations in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. - * 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 `listMirroringEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Lists associations in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. + * 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 `listMirroringEndpointGroupAssociationsAsync()` + * 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. + */ listMirroringEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse, + ] + >; listMirroringEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation + >, + ): void; listMirroringEndpointGroupAssociations( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation + >, + ): void; listMirroringEndpointGroupAssociations( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMirroringEndpointGroupAssociations values %j', values); + this._log.info( + 'listMirroringEndpointGroupAssociations values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listMirroringEndpointGroupAssociations request %j', request); + this._log.info( + 'listMirroringEndpointGroupAssociations request %j', + request, + ); return this.innerApiCalls .listMirroringEndpointGroupAssociations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse - ]) => { - this._log.info('listMirroringEndpointGroupAssociations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsResponse, + ]) => { + this._log.info( + 'listMirroringEndpointGroupAssociations values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringEndpointGroupAssociations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation} 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 `listMirroringEndpointGroupAssociationsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringEndpointGroupAssociations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation} 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 `listMirroringEndpointGroupAssociationsAsync()` + * 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. + */ listMirroringEndpointGroupAssociationsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + 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['listMirroringEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listMirroringEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringEndpointGroupAssociations stream %j', request); return this.descriptors.page.listMirroringEndpointGroupAssociations.createStream( this.innerApiCalls.listMirroringEndpointGroupAssociations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringEndpointGroupAssociations`, 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, which owns this collection of associations. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent - * page. When paginating, all other parameters provided to - * `ListMirroringEndpointGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. 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/v1alpha1/mirroring.list_mirroring_endpoint_group_associations.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringEndpointGroupAssociations_async - */ + /** + * Equivalent to `listMirroringEndpointGroupAssociations`, 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, which owns this collection of associations. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringEndpointGroups` call. Provide this to retrieve the subsequent + * page. When paginating, all other parameters provided to + * `ListMirroringEndpointGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringEndpointGroupAssociation|MirroringEndpointGroupAssociation}. 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/v1alpha1/mirroring.list_mirroring_endpoint_group_associations.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringEndpointGroupAssociations_async + */ listMirroringEndpointGroupAssociationsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringEndpointGroupAssociationsRequest, + 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['listMirroringEndpointGroupAssociations']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listMirroringEndpointGroupAssociations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMirroringEndpointGroupAssociations iterate %j', request); + this.initialize().catch((err) => { + throw err; + }); + this._log.info( + 'listMirroringEndpointGroupAssociations iterate %j', + request, + ); return this.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate( this.innerApiCalls['listMirroringEndpointGroupAssociations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployment groups in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. - * 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 `listMirroringDeploymentGroupsAsync()` - * 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. - */ + /** + * Lists deployment groups in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. + * 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 `listMirroringDeploymentGroupsAsync()` + * 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. + */ listMirroringDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse, + ] + >; listMirroringDeploymentGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup + >, + ): void; listMirroringDeploymentGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup + >, + ): void; listMirroringDeploymentGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringDeploymentGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2927,232 +4335,261 @@ export class MirroringClient { this._log.info('listMirroringDeploymentGroups request %j', request); return this.innerApiCalls .listMirroringDeploymentGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse - ]) => { - this._log.info('listMirroringDeploymentGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsResponse, + ]) => { + this._log.info('listMirroringDeploymentGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringDeploymentGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup} 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 `listMirroringDeploymentGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringDeploymentGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup} 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 `listMirroringDeploymentGroupsAsync()` + * 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. + */ listMirroringDeploymentGroupsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeploymentGroups stream %j', request); return this.descriptors.page.listMirroringDeploymentGroups.createStream( this.innerApiCalls.listMirroringDeploymentGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringDeploymentGroups`, 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, which owns this collection of deployment groups. - * Example: `projects/123456789/locations/global`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListMirroringDeploymentGroups` call. Provide this to retrieve the - * subsequent page. When paginating, all other parameters provided to - * `ListMirroringDeploymentGroups` must match the call that provided the page - * token. See https://google.aip.dev/158 for more details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. 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/v1alpha1/mirroring.list_mirroring_deployment_groups.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringDeploymentGroups_async - */ + /** + * Equivalent to `listMirroringDeploymentGroups`, 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, which owns this collection of deployment groups. + * Example: `projects/123456789/locations/global`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListMirroringDeploymentGroups` call. Provide this to retrieve the + * subsequent page. When paginating, all other parameters provided to + * `ListMirroringDeploymentGroups` must match the call that provided the page + * token. See https://google.aip.dev/158 for more details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeploymentGroup|MirroringDeploymentGroup}. 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/v1alpha1/mirroring.list_mirroring_deployment_groups.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringDeploymentGroups_async + */ listMirroringDeploymentGroupsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeploymentGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeploymentGroups iterate %j', request); return this.descriptors.page.listMirroringDeploymentGroups.asyncIterate( this.innerApiCalls['listMirroringDeploymentGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists deployments in a given project and location. - * See https://google.aip.dev/132. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. - * 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 `listMirroringDeploymentsAsync()` - * 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. - */ + /** + * Lists deployments in a given project and location. + * See https://google.aip.dev/132. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. + * 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 `listMirroringDeploymentsAsync()` + * 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. + */ listMirroringDeployments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse, + ] + >; listMirroringDeployments( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment + >, + ): void; listMirroringDeployments( - request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment + >, + ): void; listMirroringDeployments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMirroringDeployments values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3161,161 +4598,165 @@ export class MirroringClient { this._log.info('listMirroringDeployments request %j', request); return this.innerApiCalls .listMirroringDeployments(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse - ]) => { - this._log.info('listMirroringDeployments values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[], + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsResponse, + ]) => { + this._log.info('listMirroringDeployments values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMirroringDeployments`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment} 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 `listMirroringDeploymentsAsync()` - * 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. - */ + /** + * Equivalent to `listMirroringDeployments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment} 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 `listMirroringDeploymentsAsync()` + * 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. + */ listMirroringDeploymentsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeployments stream %j', request); return this.descriptors.page.listMirroringDeployments.createStream( this.innerApiCalls.listMirroringDeployments as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMirroringDeployments`, 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, which owns this collection of deployments. - * Example: `projects/123456789/locations/us-central1-a`. - * See https://google.aip.dev/132 for more details. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. See - * https://google.aip.dev/158 for more details. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListMirroringDeployments` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListMirroringDeployments` must match the call - * that provided the page token. See https://google.aip.dev/158 for more - * details. - * @param {string} [request.filter] - * Optional. Filter expression. - * See https://google.aip.dev/160#filtering for more details. - * @param {string} [request.orderBy] - * Optional. Sort expression. - * See https://google.aip.dev/132#ordering for more details. - * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. 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/v1alpha1/mirroring.list_mirroring_deployments.js - * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringDeployments_async - */ + /** + * Equivalent to `listMirroringDeployments`, 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, which owns this collection of deployments. + * Example: `projects/123456789/locations/us-central1-a`. + * See https://google.aip.dev/132 for more details. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. See + * https://google.aip.dev/158 for more details. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListMirroringDeployments` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListMirroringDeployments` must match the call + * that provided the page token. See https://google.aip.dev/158 for more + * details. + * @param {string} [request.filter] + * Optional. Filter expression. + * See https://google.aip.dev/160#filtering for more details. + * @param {string} [request.orderBy] + * Optional. Sort expression. + * See https://google.aip.dev/132#ordering for more details. + * @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.networksecurity.v1alpha1.MirroringDeployment|MirroringDeployment}. 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/v1alpha1/mirroring.list_mirroring_deployments.js + * region_tag:networksecurity_v1alpha1_generated_Mirroring_ListMirroringDeployments_async + */ listMirroringDeploymentsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListMirroringDeploymentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMirroringDeployments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMirroringDeployments iterate %j', request); return this.descriptors.page.listMirroringDeployments.asyncIterate( this.innerApiCalls['listMirroringDeployments'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -3329,40 +4770,40 @@ export class MirroringClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -3376,41 +4817,41 @@ export class MirroringClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -3424,12 +4865,12 @@ export class MirroringClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3464,12 +4905,11 @@ export class MirroringClient { | 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. @@ -3502,12 +4942,12 @@ export class MirroringClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -3550,22 +4990,22 @@ export class MirroringClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3600,15 +5040,15 @@ export class MirroringClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3642,7 +5082,7 @@ export class MirroringClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3655,25 +5095,24 @@ export class MirroringClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -3712,22 +5151,22 @@ export class MirroringClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -3743,7 +5182,11 @@ export class MirroringClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -3759,7 +5202,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -3770,7 +5215,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -3780,8 +5227,12 @@ export class MirroringClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -3792,7 +5243,7 @@ export class MirroringClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -3808,7 +5259,8 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -3819,7 +5271,8 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -3830,7 +5283,8 @@ export class MirroringClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -3841,7 +5295,11 @@ export class MirroringClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -3856,8 +5314,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -3867,8 +5329,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -3878,8 +5344,12 @@ export class MirroringClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -3890,7 +5360,11 @@ export class MirroringClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3906,7 +5380,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -3917,7 +5393,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -3928,7 +5406,9 @@ export class MirroringClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -3939,7 +5419,11 @@ export class MirroringClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -3955,7 +5439,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -3966,7 +5452,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -3976,8 +5464,12 @@ export class MirroringClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -3988,7 +5480,11 @@ export class MirroringClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -4003,8 +5499,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -4014,8 +5514,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -4025,8 +5529,12 @@ export class MirroringClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -4036,7 +5544,7 @@ export class MirroringClient { * @param {string} forwarding_rule * @returns {string} Resource name string. */ - forwardingRulePath(project:string,forwardingRule:string) { + forwardingRulePath(project: string, forwardingRule: string) { return this.pathTemplates.forwardingRulePathTemplate.render({ project: project, forwarding_rule: forwardingRule, @@ -4051,7 +5559,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).project; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).project; } /** @@ -4062,7 +5572,9 @@ export class MirroringClient { * @returns {string} A string representing the forwarding_rule. */ matchForwardingRuleFromForwardingRuleName(forwardingRuleName: string) { - return this.pathTemplates.forwardingRulePathTemplate.match(forwardingRuleName).forwarding_rule; + return this.pathTemplates.forwardingRulePathTemplate.match( + forwardingRuleName, + ).forwarding_rule; } /** @@ -4073,7 +5585,11 @@ export class MirroringClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -4089,7 +5605,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -4099,8 +5617,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -4110,8 +5632,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -4123,7 +5649,12 @@ export class MirroringClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -4139,8 +5670,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -4150,8 +5685,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -4161,8 +5700,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -4172,8 +5715,12 @@ export class MirroringClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -4184,7 +5731,11 @@ export class MirroringClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -4200,7 +5751,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -4211,7 +5764,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -4221,8 +5776,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -4233,7 +5792,11 @@ export class MirroringClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4248,8 +5811,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -4259,8 +5826,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -4270,8 +5841,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -4282,7 +5857,11 @@ export class MirroringClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4297,8 +5876,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -4308,8 +5891,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -4319,8 +5906,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -4331,12 +5922,18 @@ export class MirroringClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -4346,8 +5943,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -4357,8 +5958,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -4368,8 +5973,12 @@ export class MirroringClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -4379,7 +5988,7 @@ export class MirroringClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4416,7 +6025,11 @@ export class MirroringClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -4432,7 +6045,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -4443,7 +6058,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -4453,8 +6070,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -4465,7 +6086,11 @@ export class MirroringClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -4480,8 +6105,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -4491,8 +6120,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -4502,8 +6135,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -4514,7 +6151,11 @@ export class MirroringClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -4529,8 +6170,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -4540,8 +6185,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -4551,8 +6200,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -4563,12 +6216,18 @@ export class MirroringClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -4578,8 +6237,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -4589,8 +6252,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -4600,8 +6267,12 @@ export class MirroringClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -4611,7 +6282,7 @@ export class MirroringClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -4648,12 +6319,18 @@ export class MirroringClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4663,8 +6340,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -4674,8 +6355,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -4685,8 +6370,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4697,12 +6386,18 @@ export class MirroringClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4712,8 +6407,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -4723,8 +6422,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -4734,8 +6437,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -4746,12 +6453,18 @@ export class MirroringClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -4761,8 +6474,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -4772,8 +6489,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -4783,8 +6504,12 @@ export class MirroringClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -4795,7 +6520,11 @@ export class MirroringClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -4811,7 +6540,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -4822,7 +6553,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -4832,8 +6565,12 @@ export class MirroringClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -4844,7 +6581,11 @@ export class MirroringClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -4860,7 +6601,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -4871,7 +6614,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -4882,7 +6627,9 @@ export class MirroringClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -4891,7 +6638,7 @@ export class MirroringClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -4916,12 +6663,18 @@ export class MirroringClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -4931,8 +6684,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -4942,8 +6699,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -4953,8 +6714,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -4965,12 +6730,18 @@ export class MirroringClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -4980,8 +6751,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -4991,8 +6766,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -5002,8 +6781,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -5014,12 +6797,18 @@ export class MirroringClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -5029,8 +6818,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -5040,8 +6833,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -5051,8 +6848,12 @@ export class MirroringClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -5063,7 +6864,7 @@ export class MirroringClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -5079,7 +6880,8 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -5090,7 +6892,8 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -5101,7 +6904,8 @@ export class MirroringClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -5112,7 +6916,7 @@ export class MirroringClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -5150,7 +6954,8 @@ export class MirroringClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -5161,7 +6966,11 @@ export class MirroringClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -5177,7 +6986,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -5188,7 +6999,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -5198,8 +7011,12 @@ export class MirroringClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -5210,7 +7027,11 @@ export class MirroringClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -5226,7 +7047,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -5237,7 +7060,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -5248,7 +7073,9 @@ export class MirroringClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -5259,7 +7086,11 @@ export class MirroringClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -5275,7 +7106,9 @@ export class MirroringClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -5286,7 +7119,9 @@ export class MirroringClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -5296,8 +7131,12 @@ export class MirroringClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -5308,7 +7147,7 @@ export class MirroringClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -5357,15 +7196,19 @@ export class MirroringClient { */ close(): Promise { if (this.mirroringStub && !this._terminated) { - return this.mirroringStub.then(stub => { + return this.mirroringStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/network_security_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/network_security_client.ts index 5c48ad90e9af..e3146ed1d853 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/network_security_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/network_security_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +59,7 @@ export class NetworkSecurityClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -59,12 +72,12 @@ export class NetworkSecurityClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - networkSecurityStub?: Promise<{[name: string]: Function}>; + networkSecurityStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of NetworkSecurityClient. @@ -105,21 +118,42 @@ export class NetworkSecurityClient { * const client = new NetworkSecurityClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NetworkSecurityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -144,7 +178,7 @@ export class NetworkSecurityClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,18 +191,14 @@ export class NetworkSecurityClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -190,94 +220,102 @@ export class NetworkSecurityClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -285,24 +323,51 @@ export class NetworkSecurityClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAuthorizationPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'authorizationPolicies'), - listBackendAuthenticationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backendAuthenticationConfigs'), - listServerTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serverTlsPolicies'), - listClientTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clientTlsPolicies'), - listGatewaySecurityPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gatewaySecurityPolicies'), - listGatewaySecurityPolicyRules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'gatewaySecurityPolicyRules'), - listUrlLists: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'urlLists'), - listTlsInspectionPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tlsInspectionPolicies'), - listAuthzPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'authzPolicies') + listAuthorizationPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'authorizationPolicies', + ), + listBackendAuthenticationConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backendAuthenticationConfigs', + ), + listServerTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'serverTlsPolicies', + ), + listClientTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'clientTlsPolicies', + ), + listGatewaySecurityPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'gatewaySecurityPolicies', + ), + listGatewaySecurityPolicyRules: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'gatewaySecurityPolicyRules', + ), + listUrlLists: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'urlLists', + ), + listTlsInspectionPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'tlsInspectionPolicies', + ), + listAuthzPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'authzPolicies', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -311,244 +376,523 @@ export class NetworkSecurityClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy', + ) as gax.protobuf.Type; const createAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy', + ) as gax.protobuf.Type; const updateAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig', + ) as gax.protobuf.Type; const createBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig', + ) as gax.protobuf.Type; const updateBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteBackendAuthenticationConfigResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteBackendAuthenticationConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy', + ) as gax.protobuf.Type; const createServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy', + ) as gax.protobuf.Type; const updateServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy', + ) as gax.protobuf.Type; const createClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy', + ) as gax.protobuf.Type; const updateClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule', + ) as gax.protobuf.Type; const createGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule', + ) as gax.protobuf.Type; const updateGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyRuleResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteGatewaySecurityPolicyRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createUrlListResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.UrlList') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.UrlList', + ) as gax.protobuf.Type; const createUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateUrlListResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.UrlList') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.UrlList', + ) as gax.protobuf.Type; const updateUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteUrlListResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteUrlListMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy', + ) as gax.protobuf.Type; const createTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy', + ) as gax.protobuf.Type; const updateTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteTlsInspectionPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteTlsInspectionPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.AuthzPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.AuthzPolicy', + ) as gax.protobuf.Type; const createAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.AuthzPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.AuthzPolicy', + ) as gax.protobuf.Type; const updateAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAuthzPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAuthzPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createAuthorizationPolicyResponse.decode.bind(createAuthorizationPolicyResponse), - createAuthorizationPolicyMetadata.decode.bind(createAuthorizationPolicyMetadata)), + createAuthorizationPolicyResponse.decode.bind( + createAuthorizationPolicyResponse, + ), + createAuthorizationPolicyMetadata.decode.bind( + createAuthorizationPolicyMetadata, + ), + ), updateAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateAuthorizationPolicyResponse.decode.bind(updateAuthorizationPolicyResponse), - updateAuthorizationPolicyMetadata.decode.bind(updateAuthorizationPolicyMetadata)), + updateAuthorizationPolicyResponse.decode.bind( + updateAuthorizationPolicyResponse, + ), + updateAuthorizationPolicyMetadata.decode.bind( + updateAuthorizationPolicyMetadata, + ), + ), deleteAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteAuthorizationPolicyResponse.decode.bind(deleteAuthorizationPolicyResponse), - deleteAuthorizationPolicyMetadata.decode.bind(deleteAuthorizationPolicyMetadata)), - createBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackendAuthenticationConfigResponse.decode.bind(createBackendAuthenticationConfigResponse), - createBackendAuthenticationConfigMetadata.decode.bind(createBackendAuthenticationConfigMetadata)), - updateBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackendAuthenticationConfigResponse.decode.bind(updateBackendAuthenticationConfigResponse), - updateBackendAuthenticationConfigMetadata.decode.bind(updateBackendAuthenticationConfigMetadata)), - deleteBackendAuthenticationConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackendAuthenticationConfigResponse.decode.bind(deleteBackendAuthenticationConfigResponse), - deleteBackendAuthenticationConfigMetadata.decode.bind(deleteBackendAuthenticationConfigMetadata)), + deleteAuthorizationPolicyResponse.decode.bind( + deleteAuthorizationPolicyResponse, + ), + deleteAuthorizationPolicyMetadata.decode.bind( + deleteAuthorizationPolicyMetadata, + ), + ), + createBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackendAuthenticationConfigResponse.decode.bind( + createBackendAuthenticationConfigResponse, + ), + createBackendAuthenticationConfigMetadata.decode.bind( + createBackendAuthenticationConfigMetadata, + ), + ), + updateBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackendAuthenticationConfigResponse.decode.bind( + updateBackendAuthenticationConfigResponse, + ), + updateBackendAuthenticationConfigMetadata.decode.bind( + updateBackendAuthenticationConfigMetadata, + ), + ), + deleteBackendAuthenticationConfig: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackendAuthenticationConfigResponse.decode.bind( + deleteBackendAuthenticationConfigResponse, + ), + deleteBackendAuthenticationConfigMetadata.decode.bind( + deleteBackendAuthenticationConfigMetadata, + ), + ), createServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createServerTlsPolicyResponse.decode.bind(createServerTlsPolicyResponse), - createServerTlsPolicyMetadata.decode.bind(createServerTlsPolicyMetadata)), + createServerTlsPolicyResponse.decode.bind( + createServerTlsPolicyResponse, + ), + createServerTlsPolicyMetadata.decode.bind( + createServerTlsPolicyMetadata, + ), + ), updateServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateServerTlsPolicyResponse.decode.bind(updateServerTlsPolicyResponse), - updateServerTlsPolicyMetadata.decode.bind(updateServerTlsPolicyMetadata)), + updateServerTlsPolicyResponse.decode.bind( + updateServerTlsPolicyResponse, + ), + updateServerTlsPolicyMetadata.decode.bind( + updateServerTlsPolicyMetadata, + ), + ), deleteServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteServerTlsPolicyResponse.decode.bind(deleteServerTlsPolicyResponse), - deleteServerTlsPolicyMetadata.decode.bind(deleteServerTlsPolicyMetadata)), + deleteServerTlsPolicyResponse.decode.bind( + deleteServerTlsPolicyResponse, + ), + deleteServerTlsPolicyMetadata.decode.bind( + deleteServerTlsPolicyMetadata, + ), + ), createClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createClientTlsPolicyResponse.decode.bind(createClientTlsPolicyResponse), - createClientTlsPolicyMetadata.decode.bind(createClientTlsPolicyMetadata)), + createClientTlsPolicyResponse.decode.bind( + createClientTlsPolicyResponse, + ), + createClientTlsPolicyMetadata.decode.bind( + createClientTlsPolicyMetadata, + ), + ), updateClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateClientTlsPolicyResponse.decode.bind(updateClientTlsPolicyResponse), - updateClientTlsPolicyMetadata.decode.bind(updateClientTlsPolicyMetadata)), + updateClientTlsPolicyResponse.decode.bind( + updateClientTlsPolicyResponse, + ), + updateClientTlsPolicyMetadata.decode.bind( + updateClientTlsPolicyMetadata, + ), + ), deleteClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteClientTlsPolicyResponse.decode.bind(deleteClientTlsPolicyResponse), - deleteClientTlsPolicyMetadata.decode.bind(deleteClientTlsPolicyMetadata)), + deleteClientTlsPolicyResponse.decode.bind( + deleteClientTlsPolicyResponse, + ), + deleteClientTlsPolicyMetadata.decode.bind( + deleteClientTlsPolicyMetadata, + ), + ), createGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createGatewaySecurityPolicyResponse.decode.bind(createGatewaySecurityPolicyResponse), - createGatewaySecurityPolicyMetadata.decode.bind(createGatewaySecurityPolicyMetadata)), + createGatewaySecurityPolicyResponse.decode.bind( + createGatewaySecurityPolicyResponse, + ), + createGatewaySecurityPolicyMetadata.decode.bind( + createGatewaySecurityPolicyMetadata, + ), + ), updateGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateGatewaySecurityPolicyResponse.decode.bind(updateGatewaySecurityPolicyResponse), - updateGatewaySecurityPolicyMetadata.decode.bind(updateGatewaySecurityPolicyMetadata)), + updateGatewaySecurityPolicyResponse.decode.bind( + updateGatewaySecurityPolicyResponse, + ), + updateGatewaySecurityPolicyMetadata.decode.bind( + updateGatewaySecurityPolicyMetadata, + ), + ), deleteGatewaySecurityPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteGatewaySecurityPolicyResponse.decode.bind(deleteGatewaySecurityPolicyResponse), - deleteGatewaySecurityPolicyMetadata.decode.bind(deleteGatewaySecurityPolicyMetadata)), - createGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGatewaySecurityPolicyRuleResponse.decode.bind(createGatewaySecurityPolicyRuleResponse), - createGatewaySecurityPolicyRuleMetadata.decode.bind(createGatewaySecurityPolicyRuleMetadata)), - updateGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateGatewaySecurityPolicyRuleResponse.decode.bind(updateGatewaySecurityPolicyRuleResponse), - updateGatewaySecurityPolicyRuleMetadata.decode.bind(updateGatewaySecurityPolicyRuleMetadata)), - deleteGatewaySecurityPolicyRule: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGatewaySecurityPolicyRuleResponse.decode.bind(deleteGatewaySecurityPolicyRuleResponse), - deleteGatewaySecurityPolicyRuleMetadata.decode.bind(deleteGatewaySecurityPolicyRuleMetadata)), + deleteGatewaySecurityPolicyResponse.decode.bind( + deleteGatewaySecurityPolicyResponse, + ), + deleteGatewaySecurityPolicyMetadata.decode.bind( + deleteGatewaySecurityPolicyMetadata, + ), + ), + createGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGatewaySecurityPolicyRuleResponse.decode.bind( + createGatewaySecurityPolicyRuleResponse, + ), + createGatewaySecurityPolicyRuleMetadata.decode.bind( + createGatewaySecurityPolicyRuleMetadata, + ), + ), + updateGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateGatewaySecurityPolicyRuleResponse.decode.bind( + updateGatewaySecurityPolicyRuleResponse, + ), + updateGatewaySecurityPolicyRuleMetadata.decode.bind( + updateGatewaySecurityPolicyRuleMetadata, + ), + ), + deleteGatewaySecurityPolicyRule: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGatewaySecurityPolicyRuleResponse.decode.bind( + deleteGatewaySecurityPolicyRuleResponse, + ), + deleteGatewaySecurityPolicyRuleMetadata.decode.bind( + deleteGatewaySecurityPolicyRuleMetadata, + ), + ), createUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createUrlListResponse.decode.bind(createUrlListResponse), - createUrlListMetadata.decode.bind(createUrlListMetadata)), + createUrlListMetadata.decode.bind(createUrlListMetadata), + ), updateUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateUrlListResponse.decode.bind(updateUrlListResponse), - updateUrlListMetadata.decode.bind(updateUrlListMetadata)), + updateUrlListMetadata.decode.bind(updateUrlListMetadata), + ), deleteUrlList: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteUrlListResponse.decode.bind(deleteUrlListResponse), - deleteUrlListMetadata.decode.bind(deleteUrlListMetadata)), + deleteUrlListMetadata.decode.bind(deleteUrlListMetadata), + ), createTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createTlsInspectionPolicyResponse.decode.bind(createTlsInspectionPolicyResponse), - createTlsInspectionPolicyMetadata.decode.bind(createTlsInspectionPolicyMetadata)), + createTlsInspectionPolicyResponse.decode.bind( + createTlsInspectionPolicyResponse, + ), + createTlsInspectionPolicyMetadata.decode.bind( + createTlsInspectionPolicyMetadata, + ), + ), updateTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateTlsInspectionPolicyResponse.decode.bind(updateTlsInspectionPolicyResponse), - updateTlsInspectionPolicyMetadata.decode.bind(updateTlsInspectionPolicyMetadata)), + updateTlsInspectionPolicyResponse.decode.bind( + updateTlsInspectionPolicyResponse, + ), + updateTlsInspectionPolicyMetadata.decode.bind( + updateTlsInspectionPolicyMetadata, + ), + ), deleteTlsInspectionPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteTlsInspectionPolicyResponse.decode.bind(deleteTlsInspectionPolicyResponse), - deleteTlsInspectionPolicyMetadata.decode.bind(deleteTlsInspectionPolicyMetadata)), + deleteTlsInspectionPolicyResponse.decode.bind( + deleteTlsInspectionPolicyResponse, + ), + deleteTlsInspectionPolicyMetadata.decode.bind( + deleteTlsInspectionPolicyMetadata, + ), + ), createAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createAuthzPolicyResponse.decode.bind(createAuthzPolicyResponse), - createAuthzPolicyMetadata.decode.bind(createAuthzPolicyMetadata)), + createAuthzPolicyMetadata.decode.bind(createAuthzPolicyMetadata), + ), updateAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAuthzPolicyResponse.decode.bind(updateAuthzPolicyResponse), - updateAuthzPolicyMetadata.decode.bind(updateAuthzPolicyMetadata)), + updateAuthzPolicyMetadata.decode.bind(updateAuthzPolicyMetadata), + ), deleteAuthzPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAuthzPolicyResponse.decode.bind(deleteAuthzPolicyResponse), - deleteAuthzPolicyMetadata.decode.bind(deleteAuthzPolicyMetadata)) + deleteAuthzPolicyMetadata.decode.bind(deleteAuthzPolicyMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.NetworkSecurity', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.NetworkSecurity', + 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 @@ -579,28 +923,80 @@ export class NetworkSecurityClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.NetworkSecurity. this.networkSecurityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.NetworkSecurity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.NetworkSecurity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.NetworkSecurity', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .NetworkSecurity, + 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 networkSecurityStubMethods = - ['listAuthorizationPolicies', 'getAuthorizationPolicy', 'createAuthorizationPolicy', 'updateAuthorizationPolicy', 'deleteAuthorizationPolicy', 'listBackendAuthenticationConfigs', 'getBackendAuthenticationConfig', 'createBackendAuthenticationConfig', 'updateBackendAuthenticationConfig', 'deleteBackendAuthenticationConfig', 'listServerTlsPolicies', 'getServerTlsPolicy', 'createServerTlsPolicy', 'updateServerTlsPolicy', 'deleteServerTlsPolicy', 'listClientTlsPolicies', 'getClientTlsPolicy', 'createClientTlsPolicy', 'updateClientTlsPolicy', 'deleteClientTlsPolicy', 'listGatewaySecurityPolicies', 'getGatewaySecurityPolicy', 'createGatewaySecurityPolicy', 'updateGatewaySecurityPolicy', 'deleteGatewaySecurityPolicy', 'listGatewaySecurityPolicyRules', 'getGatewaySecurityPolicyRule', 'createGatewaySecurityPolicyRule', 'updateGatewaySecurityPolicyRule', 'deleteGatewaySecurityPolicyRule', 'listUrlLists', 'getUrlList', 'createUrlList', 'updateUrlList', 'deleteUrlList', 'listTlsInspectionPolicies', 'getTlsInspectionPolicy', 'createTlsInspectionPolicy', 'updateTlsInspectionPolicy', 'deleteTlsInspectionPolicy', 'listAuthzPolicies', 'getAuthzPolicy', 'createAuthzPolicy', 'updateAuthzPolicy', 'deleteAuthzPolicy']; + const networkSecurityStubMethods = [ + 'listAuthorizationPolicies', + 'getAuthorizationPolicy', + 'createAuthorizationPolicy', + 'updateAuthorizationPolicy', + 'deleteAuthorizationPolicy', + 'listBackendAuthenticationConfigs', + 'getBackendAuthenticationConfig', + 'createBackendAuthenticationConfig', + 'updateBackendAuthenticationConfig', + 'deleteBackendAuthenticationConfig', + 'listServerTlsPolicies', + 'getServerTlsPolicy', + 'createServerTlsPolicy', + 'updateServerTlsPolicy', + 'deleteServerTlsPolicy', + 'listClientTlsPolicies', + 'getClientTlsPolicy', + 'createClientTlsPolicy', + 'updateClientTlsPolicy', + 'deleteClientTlsPolicy', + 'listGatewaySecurityPolicies', + 'getGatewaySecurityPolicy', + 'createGatewaySecurityPolicy', + 'updateGatewaySecurityPolicy', + 'deleteGatewaySecurityPolicy', + 'listGatewaySecurityPolicyRules', + 'getGatewaySecurityPolicyRule', + 'createGatewaySecurityPolicyRule', + 'updateGatewaySecurityPolicyRule', + 'deleteGatewaySecurityPolicyRule', + 'listUrlLists', + 'getUrlList', + 'createUrlList', + 'updateUrlList', + 'deleteUrlList', + 'listTlsInspectionPolicies', + 'getTlsInspectionPolicy', + 'createTlsInspectionPolicy', + 'updateTlsInspectionPolicy', + 'deleteTlsInspectionPolicy', + 'listAuthzPolicies', + 'getAuthzPolicy', + 'createAuthzPolicy', + 'updateAuthzPolicy', + 'deleteAuthzPolicy', + ]; for (const methodName of networkSecurityStubMethods) { const callPromise = this.networkSecurityStub.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) => () => { + (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] || @@ -610,7 +1006,7 @@ export class NetworkSecurityClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -625,8 +1021,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -637,8 +1039,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -669,9 +1077,7 @@ export class NetworkSecurityClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -680,8 +1086,9 @@ export class NetworkSecurityClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -692,4031 +1099,6234 @@ export class NetworkSecurityClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. - * 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/v1alpha1/network_security.get_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetAuthorizationPolicy_async - */ + /** + * Gets details of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. + * 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/v1alpha1/network_security.get_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetAuthorizationPolicy_async + */ getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAuthorizationPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAuthorizationPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAuthorizationPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAuthorizationPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the BackendAuthenticationConfig to get. Must be in the - * format `projects/* /locations/{location}/backendAuthenticationConfigs/*`. - * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. - * 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/v1alpha1/network_security.get_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetBackendAuthenticationConfig_async - */ + /** + * Gets details of a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the BackendAuthenticationConfig to get. Must be in the + * format `projects/* /locations/{location}/backendAuthenticationConfigs/*`. + * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. + * 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/v1alpha1/network_security.get_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetBackendAuthenticationConfig_async + */ getBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ] + >; getBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getBackendAuthenticationConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getBackendAuthenticationConfig response %j', response); + this._log.info( + 'getBackendAuthenticationConfig response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, - protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBackendAuthenticationConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetBackendAuthenticationConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getBackendAuthenticationConfig response %j', + response, + ); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. - * 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/v1alpha1/network_security.get_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetServerTlsPolicy_async - */ + /** + * Gets details of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. + * 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/v1alpha1/network_security.get_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetServerTlsPolicy_async + */ getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getServerTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getServerTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServerTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getServerTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. - * 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/v1alpha1/network_security.get_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetClientTlsPolicy_async - */ + /** + * Gets details of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. + * 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/v1alpha1/network_security.get_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetClientTlsPolicy_async + */ getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getClientTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { this._log.info('getClientTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getClientTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getClientTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. - * 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/v1alpha1/network_security.get_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetGatewaySecurityPolicy_async - */ + /** + * Gets details of a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. + * 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/v1alpha1/network_security.get_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetGatewaySecurityPolicy_async + */ getGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGatewaySecurityPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGatewaySecurityPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGatewaySecurityPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getGatewaySecurityPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the GatewaySecurityPolicyRule to retrieve. - * Format: - * projects/{project}/location/{location}/gatewaySecurityPolicies/* /rules/* - * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. - * 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/v1alpha1/network_security.get_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetGatewaySecurityPolicyRule_async - */ + /** + * Gets details of a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the GatewaySecurityPolicyRule to retrieve. + * Format: + * projects/{project}/location/{location}/gatewaySecurityPolicies/* /rules/* + * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. + * 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/v1alpha1/network_security.get_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetGatewaySecurityPolicyRule_async + */ getGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ] + >; getGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGatewaySecurityPolicyRule request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGatewaySecurityPolicyRule response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, - protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGatewaySecurityPolicyRule response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetGatewaySecurityPolicyRuleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getGatewaySecurityPolicyRule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the UrlList to get. Must be in the format - * `projects/* /locations/{location}/urlLists/*`. - * @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.networksecurity.v1alpha1.UrlList|UrlList}. - * 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/v1alpha1/network_security.get_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetUrlList_async - */ + /** + * Gets details of a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the UrlList to get. Must be in the format + * `projects/* /locations/{location}/urlLists/*`. + * @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.networksecurity.v1alpha1.UrlList|UrlList}. + * 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/v1alpha1/network_security.get_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetUrlList_async + */ getUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | undefined + ), + {} | undefined, + ] + >; getUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getUrlList request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getUrlList response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getUrlList(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IUrlList, - protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUrlList response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getUrlList(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetUrlListRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getUrlList response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the TlsInspectionPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. - * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. - * 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/v1alpha1/network_security.get_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetTlsInspectionPolicy_async - */ + /** + * Gets details of a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the TlsInspectionPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. + * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. + * 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/v1alpha1/network_security.get_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetTlsInspectionPolicy_async + */ getTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getTlsInspectionPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getTlsInspectionPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getTlsInspectionPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetTlsInspectionPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getTlsInspectionPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the `AuthzPolicy` resource to get. Must be in the - * format - * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. - * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. - * 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/v1alpha1/network_security.get_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetAuthzPolicy_async - */ + /** + * Gets details of a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the `AuthzPolicy` resource to get. Must be in the + * format + * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. + * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. + * 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/v1alpha1/network_security.get_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_GetAuthzPolicy_async + */ getAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAuthzPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAuthzPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, - protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAuthzPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetAuthzPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAuthzPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new AuthorizationPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the AuthorizationPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.authorizationPolicyId - * Required. Short name of the AuthorizationPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "authz_policy". - * @param {google.cloud.networksecurity.v1alpha1.AuthorizationPolicy} request.authorizationPolicy - * Required. AuthorizationPolicy resource to be created. - * @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/v1alpha1/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ + /** + * Creates a new AuthorizationPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the AuthorizationPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.authorizationPolicyId + * Required. Short name of the AuthorizationPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "authz_policy". + * @param {google.cloud.networksecurity.v1alpha1.AuthorizationPolicy} request.authorizationPolicy + * Required. AuthorizationPolicy resource to be created. + * @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/v1alpha1/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAuthorizationPolicy request %j', request); - return this.innerApiCalls.createAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAuthorizationPolicy()`. - * @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/v1alpha1/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ - async checkCreateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAuthorizationPolicy()`. + * @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/v1alpha1/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ + async checkCreateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * AuthorizationPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.AuthorizationPolicy} request.authorizationPolicy - * Required. Updated AuthorizationPolicy 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/v1alpha1/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ + /** + * Updates the parameters of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * AuthorizationPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.AuthorizationPolicy} request.authorizationPolicy + * Required. Updated AuthorizationPolicy 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/v1alpha1/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAuthorizationPolicy request %j', request); - return this.innerApiCalls.updateAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. - * @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/v1alpha1/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ - async checkUpdateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. + * @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/v1alpha1/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ + async checkUpdateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to delete. Must be in the - * format `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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/v1alpha1/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ + /** + * Deletes a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to delete. Must be in the + * format `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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/v1alpha1/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAuthorizationPolicy request %j', request); - return this.innerApiCalls.deleteAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. - * @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/v1alpha1/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ - async checkDeleteAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. + * @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/v1alpha1/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ + async checkDeleteAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new BackendAuthenticationConfig in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the BackendAuthenticationConfig. Must be - * in the format `projects/* /locations/{location}`. - * @param {string} request.backendAuthenticationConfigId - * Required. Short name of the BackendAuthenticationConfig resource to be - * created. This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start with a - * number. E.g. "backend-auth-config". - * @param {google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig} request.backendAuthenticationConfig - * Required. BackendAuthenticationConfig resource to be created. - * @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/v1alpha1/network_security.create_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async - */ + /** + * Creates a new BackendAuthenticationConfig in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the BackendAuthenticationConfig. Must be + * in the format `projects/* /locations/{location}`. + * @param {string} request.backendAuthenticationConfigId + * Required. Short name of the BackendAuthenticationConfig resource to be + * created. This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start with a + * number. E.g. "backend-auth-config". + * @param {google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig} request.backendAuthenticationConfig + * Required. BackendAuthenticationConfig resource to be created. + * @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/v1alpha1/network_security.create_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async + */ createBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'createBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.createBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createBackendAuthenticationConfig()`. - * @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/v1alpha1/network_security.create_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async - */ - async checkCreateBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createBackendAuthenticationConfig()`. + * @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/v1alpha1/network_security.create_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateBackendAuthenticationConfig_async + */ + async checkCreateBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * BackendAuthenticationConfig resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig} request.backendAuthenticationConfig - * Required. Updated BackendAuthenticationConfig 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/v1alpha1/network_security.update_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async - */ + /** + * Updates the parameters of a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * BackendAuthenticationConfig resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig} request.backendAuthenticationConfig + * Required. Updated BackendAuthenticationConfig 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/v1alpha1/network_security.update_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async + */ updateBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'backend_authentication_config.name': request.backendAuthenticationConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backend_authentication_config.name': + request.backendAuthenticationConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'updateBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.updateBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateBackendAuthenticationConfig()`. - * @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/v1alpha1/network_security.update_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async - */ - async checkUpdateBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateBackendAuthenticationConfig()`. + * @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/v1alpha1/network_security.update_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateBackendAuthenticationConfig_async + */ + async checkUpdateBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single BackendAuthenticationConfig to - * BackendAuthenticationConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the BackendAuthenticationConfig to delete. Must be in - * the format - * `projects/* /locations/{location}/backendAuthenticationConfigs/*`. - * @param {string} [request.etag] - * Optional. Etag of the resource. - * If this is provided, it must match the server's etag. - * @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/v1alpha1/network_security.delete_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async - */ + /** + * Deletes a single BackendAuthenticationConfig to + * BackendAuthenticationConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the BackendAuthenticationConfig to delete. Must be in + * the format + * `projects/* /locations/{location}/backendAuthenticationConfigs/*`. + * @param {string} [request.etag] + * Optional. Etag of the resource. + * If this is provided, it must match the server's etag. + * @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/v1alpha1/network_security.delete_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async + */ deleteBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteBackendAuthenticationConfig( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteBackendAuthenticationConfig( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteBackendAuthenticationConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteBackendAuthenticationConfig response %j', rawResponse); + this._log.info( + 'deleteBackendAuthenticationConfig response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteBackendAuthenticationConfig request %j', request); - return this.innerApiCalls.deleteBackendAuthenticationConfig(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteBackendAuthenticationConfig response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteBackendAuthenticationConfig(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteBackendAuthenticationConfig response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteBackendAuthenticationConfig()`. - * @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/v1alpha1/network_security.delete_backend_authentication_config.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async - */ - async checkDeleteBackendAuthenticationConfigProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteBackendAuthenticationConfig()`. + * @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/v1alpha1/network_security.delete_backend_authentication_config.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteBackendAuthenticationConfig_async + */ + async checkDeleteBackendAuthenticationConfigProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteBackendAuthenticationConfig long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteBackendAuthenticationConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteBackendAuthenticationConfig, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new ServerTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ServerTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.serverTlsPolicyId - * Required. Short name of the ServerTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "server_mtls_policy". - * @param {google.cloud.networksecurity.v1alpha1.ServerTlsPolicy} request.serverTlsPolicy - * Required. ServerTlsPolicy resource to be created. - * @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/v1alpha1/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ + /** + * Creates a new ServerTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ServerTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.serverTlsPolicyId + * Required. Short name of the ServerTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "server_mtls_policy". + * @param {google.cloud.networksecurity.v1alpha1.ServerTlsPolicy} request.serverTlsPolicy + * Required. ServerTlsPolicy resource to be created. + * @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/v1alpha1/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createServerTlsPolicy request %j', request); - return this.innerApiCalls.createServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createServerTlsPolicy()`. - * @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/v1alpha1/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ - async checkCreateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createServerTlsPolicy()`. + * @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/v1alpha1/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ + async checkCreateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ServerTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1alpha1.ServerTlsPolicy} request.serverTlsPolicy - * Required. Updated ServerTlsPolicy 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/v1alpha1/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ + /** + * Updates the parameters of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ServerTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1alpha1.ServerTlsPolicy} request.serverTlsPolicy + * Required. Updated ServerTlsPolicy 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/v1alpha1/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateServerTlsPolicy request %j', request); - return this.innerApiCalls.updateServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateServerTlsPolicy()`. - * @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/v1alpha1/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ - async checkUpdateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateServerTlsPolicy()`. + * @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/v1alpha1/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ + async checkUpdateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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/v1alpha1/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ + /** + * Deletes a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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/v1alpha1/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteServerTlsPolicy request %j', request); - return this.innerApiCalls.deleteServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. - * @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/v1alpha1/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ - async checkDeleteServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. + * @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/v1alpha1/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ + async checkDeleteServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new ClientTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ClientTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.clientTlsPolicyId - * Required. Short name of the ClientTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "client_mtls_policy". - * @param {google.cloud.networksecurity.v1alpha1.ClientTlsPolicy} request.clientTlsPolicy - * Required. ClientTlsPolicy resource to be created. - * @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/v1alpha1/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ + /** + * Creates a new ClientTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ClientTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.clientTlsPolicyId + * Required. Short name of the ClientTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "client_mtls_policy". + * @param {google.cloud.networksecurity.v1alpha1.ClientTlsPolicy} request.clientTlsPolicy + * Required. ClientTlsPolicy resource to be created. + * @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/v1alpha1/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createClientTlsPolicy request %j', request); - return this.innerApiCalls.createClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createClientTlsPolicy()`. - * @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/v1alpha1/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ - async checkCreateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createClientTlsPolicy()`. + * @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/v1alpha1/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ + async checkCreateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ClientTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1alpha1.ClientTlsPolicy} request.clientTlsPolicy - * Required. Updated ClientTlsPolicy 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/v1alpha1/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ + /** + * Updates the parameters of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ClientTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1alpha1.ClientTlsPolicy} request.clientTlsPolicy + * Required. Updated ClientTlsPolicy 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/v1alpha1/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateClientTlsPolicy request %j', request); - return this.innerApiCalls.updateClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateClientTlsPolicy()`. - * @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/v1alpha1/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ - async checkUpdateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateClientTlsPolicy()`. + * @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/v1alpha1/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ + async checkUpdateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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/v1alpha1/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ + /** + * Deletes a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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/v1alpha1/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteClientTlsPolicy request %j', request); - return this.innerApiCalls.deleteClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. - * @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/v1alpha1/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ - async checkDeleteClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. + * @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/v1alpha1/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ + async checkDeleteClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new GatewaySecurityPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the GatewaySecurityPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.gatewaySecurityPolicyId - * Required. Short name of the GatewaySecurityPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "gateway_security_policy1". - * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy} request.gatewaySecurityPolicy - * Required. GatewaySecurityPolicy resource to be created. - * @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/v1alpha1/network_security.create_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async - */ + /** + * Creates a new GatewaySecurityPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the GatewaySecurityPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.gatewaySecurityPolicyId + * Required. Short name of the GatewaySecurityPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "gateway_security_policy1". + * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy} request.gatewaySecurityPolicy + * Required. GatewaySecurityPolicy resource to be created. + * @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/v1alpha1/network_security.create_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async + */ createGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'createGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.createGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createGatewaySecurityPolicy()`. - * @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/v1alpha1/network_security.create_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async - */ - async checkCreateGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createGatewaySecurityPolicy()`. + * @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/v1alpha1/network_security.create_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicy_async + */ + async checkCreateGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * GatewaySecurityPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy} request.gatewaySecurityPolicy - * Required. Updated GatewaySecurityPolicy 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/v1alpha1/network_security.update_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async - */ + /** + * Updates the parameters of a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * GatewaySecurityPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy} request.gatewaySecurityPolicy + * Required. Updated GatewaySecurityPolicy 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/v1alpha1/network_security.update_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async + */ updateGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'gateway_security_policy.name': request.gatewaySecurityPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'gateway_security_policy.name': + request.gatewaySecurityPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'updateGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.updateGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateGatewaySecurityPolicy()`. - * @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/v1alpha1/network_security.update_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async - */ - async checkUpdateGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateGatewaySecurityPolicy()`. + * @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/v1alpha1/network_security.update_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicy_async + */ + async checkUpdateGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single GatewaySecurityPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicy to delete. Must be in the - * format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. - * @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/v1alpha1/network_security.delete_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async - */ + /** + * Deletes a single GatewaySecurityPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicy to delete. Must be in the + * format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. + * @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/v1alpha1/network_security.delete_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async + */ deleteGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteGatewaySecurityPolicy response %j', rawResponse); + this._log.info( + 'deleteGatewaySecurityPolicy response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteGatewaySecurityPolicy request %j', request); - return this.innerApiCalls.deleteGatewaySecurityPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGatewaySecurityPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteGatewaySecurityPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteGatewaySecurityPolicy response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteGatewaySecurityPolicy()`. - * @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/v1alpha1/network_security.delete_gateway_security_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async - */ - async checkDeleteGatewaySecurityPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteGatewaySecurityPolicy()`. + * @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/v1alpha1/network_security.delete_gateway_security_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicy_async + */ + async checkDeleteGatewaySecurityPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteGatewaySecurityPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteGatewaySecurityPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteGatewaySecurityPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new GatewaySecurityPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent where this rule will be created. - * Format : - * projects/{project}/location/{location}/gatewaySecurityPolicies/* - * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule - * Required. The rule to be created. - * @param {string} request.gatewaySecurityPolicyRuleId - * The ID to use for the rule, which will become the final component of - * the rule's resource name. - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. - * @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/v1alpha1/network_security.create_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async - */ + /** + * Creates a new GatewaySecurityPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent where this rule will be created. + * Format : + * projects/{project}/location/{location}/gatewaySecurityPolicies/* + * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule + * Required. The rule to be created. + * @param {string} request.gatewaySecurityPolicyRuleId + * The ID to use for the rule, which will become the final component of + * the rule's resource name. + * This value should be 4-63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. + * @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/v1alpha1/network_security.create_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async + */ createGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'createGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.createGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createGatewaySecurityPolicyRule()`. - * @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/v1alpha1/network_security.create_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async - */ - async checkCreateGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createGatewaySecurityPolicyRule()`. + * @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/v1alpha1/network_security.create_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateGatewaySecurityPolicyRule_async + */ + async checkCreateGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * GatewaySecurityPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule - * Required. Updated GatewaySecurityPolicyRule 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/v1alpha1/network_security.update_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async - */ + /** + * Updates the parameters of a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * GatewaySecurityPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule} request.gatewaySecurityPolicyRule + * Required. Updated GatewaySecurityPolicyRule 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/v1alpha1/network_security.update_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async + */ updateGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'gateway_security_policy_rule.name': request.gatewaySecurityPolicyRule!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'gateway_security_policy_rule.name': + request.gatewaySecurityPolicyRule!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'updateGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.updateGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateGatewaySecurityPolicyRule()`. - * @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/v1alpha1/network_security.update_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async - */ - async checkUpdateGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateGatewaySecurityPolicyRule()`. + * @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/v1alpha1/network_security.update_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateGatewaySecurityPolicyRule_async + */ + async checkUpdateGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single GatewaySecurityPolicyRule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the GatewaySecurityPolicyRule to delete. Must be in the - * format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}/rules/*`. - * @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/v1alpha1/network_security.delete_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async - */ + /** + * Deletes a single GatewaySecurityPolicyRule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the GatewaySecurityPolicyRule to delete. Must be in the + * format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}/rules/*`. + * @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/v1alpha1/network_security.delete_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async + */ deleteGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicyRule( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGatewaySecurityPolicyRule( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteGatewaySecurityPolicyRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteGatewaySecurityPolicyRule response %j', rawResponse); + this._log.info( + 'deleteGatewaySecurityPolicyRule response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteGatewaySecurityPolicyRule request %j', request); - return this.innerApiCalls.deleteGatewaySecurityPolicyRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGatewaySecurityPolicyRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteGatewaySecurityPolicyRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteGatewaySecurityPolicyRule response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteGatewaySecurityPolicyRule()`. - * @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/v1alpha1/network_security.delete_gateway_security_policy_rule.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async - */ - async checkDeleteGatewaySecurityPolicyRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteGatewaySecurityPolicyRule()`. + * @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/v1alpha1/network_security.delete_gateway_security_policy_rule.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteGatewaySecurityPolicyRule_async + */ + async checkDeleteGatewaySecurityPolicyRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteGatewaySecurityPolicyRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteGatewaySecurityPolicyRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteGatewaySecurityPolicyRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new UrlList in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the UrlList. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.urlListId - * Required. Short name of the UrlList resource to be created. This value - * should be 1-63 characters long, containing only letters, numbers, hyphens, - * and underscores, and should not start with a number. E.g. "url_list". - * @param {google.cloud.networksecurity.v1alpha1.UrlList} request.urlList - * Required. UrlList resource to be created. - * @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/v1alpha1/network_security.create_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateUrlList_async - */ + /** + * Creates a new UrlList in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the UrlList. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.urlListId + * Required. Short name of the UrlList resource to be created. This value + * should be 1-63 characters long, containing only letters, numbers, hyphens, + * and underscores, and should not start with a number. E.g. "url_list". + * @param {google.cloud.networksecurity.v1alpha1.UrlList} request.urlList + * Required. UrlList resource to be created. + * @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/v1alpha1/network_security.create_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateUrlList_async + */ createUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createUrlList request %j', request); - return this.innerApiCalls.createUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createUrlList()`. - * @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/v1alpha1/network_security.create_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateUrlList_async - */ - async checkCreateUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createUrlList()`. + * @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/v1alpha1/network_security.create_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateUrlList_async + */ + async checkCreateUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.UrlList, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.UrlList, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * UrlList resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1alpha1.UrlList} request.urlList - * Required. Updated UrlList 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/v1alpha1/network_security.update_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateUrlList_async - */ + /** + * Updates the parameters of a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * UrlList resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1alpha1.UrlList} request.urlList + * Required. Updated UrlList 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/v1alpha1/network_security.update_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateUrlList_async + */ updateUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'url_list.name': request.urlList!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'url_list.name': request.urlList!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateUrlList request %j', request); - return this.innerApiCalls.updateUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateUrlList()`. - * @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/v1alpha1/network_security.update_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateUrlList_async - */ - async checkUpdateUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateUrlList()`. + * @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/v1alpha1/network_security.update_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateUrlList_async + */ + async checkUpdateUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.UrlList, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.UrlList, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single UrlList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the UrlList to delete. Must be in - * the format `projects/* /locations/{location}/urlLists/*`. - * @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/v1alpha1/network_security.delete_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteUrlList_async - */ + /** + * Deletes a single UrlList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the UrlList to delete. Must be in + * the format `projects/* /locations/{location}/urlLists/*`. + * @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/v1alpha1/network_security.delete_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteUrlList_async + */ deleteUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUrlList( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUrlList( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteUrlListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteUrlList response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteUrlList request %j', request); - return this.innerApiCalls.deleteUrlList(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteUrlList response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteUrlList(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteUrlList response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteUrlList()`. - * @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/v1alpha1/network_security.delete_url_list.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteUrlList_async - */ - async checkDeleteUrlListProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteUrlList()`. + * @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/v1alpha1/network_security.delete_url_list.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteUrlList_async + */ + async checkDeleteUrlListProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteUrlList long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteUrlList, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteUrlList, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new TlsInspectionPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the TlsInspectionPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.tlsInspectionPolicyId - * Required. Short name of the TlsInspectionPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "tls_inspection_policy1". - * @param {google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy} request.tlsInspectionPolicy - * Required. TlsInspectionPolicy resource to be created. - * @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/v1alpha1/network_security.create_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async - */ + /** + * Creates a new TlsInspectionPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the TlsInspectionPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.tlsInspectionPolicyId + * Required. Short name of the TlsInspectionPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "tls_inspection_policy1". + * @param {google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy} request.tlsInspectionPolicy + * Required. TlsInspectionPolicy resource to be created. + * @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/v1alpha1/network_security.create_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async + */ createTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createTlsInspectionPolicy request %j', request); - return this.innerApiCalls.createTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createTlsInspectionPolicy()`. - * @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/v1alpha1/network_security.create_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async - */ - async checkCreateTlsInspectionPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createTlsInspectionPolicy()`. + * @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/v1alpha1/network_security.create_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateTlsInspectionPolicy_async + */ + async checkCreateTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * TlsInspectionPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy} request.tlsInspectionPolicy - * Required. Updated TlsInspectionPolicy 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/v1alpha1/network_security.update_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async - */ + /** + * Updates the parameters of a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * TlsInspectionPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy} request.tlsInspectionPolicy + * Required. Updated TlsInspectionPolicy 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/v1alpha1/network_security.update_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async + */ updateTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'tls_inspection_policy.name': request.tlsInspectionPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'tls_inspection_policy.name': request.tlsInspectionPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateTlsInspectionPolicy request %j', request); - return this.innerApiCalls.updateTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateTlsInspectionPolicy()`. - * @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/v1alpha1/network_security.update_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async - */ - async checkUpdateTlsInspectionPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateTlsInspectionPolicy()`. + * @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/v1alpha1/network_security.update_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateTlsInspectionPolicy_async + */ + async checkUpdateTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single TlsInspectionPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the TlsInspectionPolicy to delete. Must be in the - * format - * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. - * @param {boolean} request.force - * If set to true, any rules for this TlsInspectionPolicy will also be - * deleted. (Otherwise, the request will only work if the TlsInspectionPolicy - * has no rules.) - * @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/v1alpha1/network_security.delete_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async - */ + /** + * Deletes a single TlsInspectionPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the TlsInspectionPolicy to delete. Must be in the + * format + * `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. + * @param {boolean} request.force + * If set to true, any rules for this TlsInspectionPolicy will also be + * deleted. (Otherwise, the request will only work if the TlsInspectionPolicy + * has no rules.) + * @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/v1alpha1/network_security.delete_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async + */ deleteTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTlsInspectionPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTlsInspectionPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteTlsInspectionPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteTlsInspectionPolicy request %j', request); - return this.innerApiCalls.deleteTlsInspectionPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteTlsInspectionPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteTlsInspectionPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteTlsInspectionPolicy()`. - * @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/v1alpha1/network_security.delete_tls_inspection_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async - */ - async checkDeleteTlsInspectionPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteTlsInspectionPolicy()`. + * @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/v1alpha1/network_security.delete_tls_inspection_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteTlsInspectionPolicy_async + */ + async checkDeleteTlsInspectionPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteTlsInspectionPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteTlsInspectionPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteTlsInspectionPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new AuthzPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the `AuthzPolicy` resource. Must be in - * the format `projects/{project}/locations/{location}`. - * @param {string} request.authzPolicyId - * Required. User-provided ID of the `AuthzPolicy` resource to be created. - * @param {google.cloud.networksecurity.v1alpha1.AuthzPolicy} request.authzPolicy - * Required. `AuthzPolicy` resource to be created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/network_security.create_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthzPolicy_async - */ + /** + * Creates a new AuthzPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the `AuthzPolicy` resource. Must be in + * the format `projects/{project}/locations/{location}`. + * @param {string} request.authzPolicyId + * Required. User-provided ID of the `AuthzPolicy` resource to be created. + * @param {google.cloud.networksecurity.v1alpha1.AuthzPolicy} request.authzPolicy + * Required. `AuthzPolicy` resource to be created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/network_security.create_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthzPolicy_async + */ createAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAuthzPolicy request %j', request); - return this.innerApiCalls.createAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAuthzPolicy()`. - * @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/v1alpha1/network_security.create_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthzPolicy_async - */ - async checkCreateAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAuthzPolicy()`. + * @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/v1alpha1/network_security.create_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_CreateAuthzPolicy_async + */ + async checkCreateAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Used to specify the fields to be overwritten in the - * `AuthzPolicy` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field is overwritten if it is in the mask. If the - * user does not specify a mask, then all fields are overwritten. - * @param {google.cloud.networksecurity.v1alpha1.AuthzPolicy} request.authzPolicy - * Required. `AuthzPolicy` resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/network_security.update_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthzPolicy_async - */ + /** + * Updates the parameters of a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Used to specify the fields to be overwritten in the + * `AuthzPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field is overwritten if it is in the mask. If the + * user does not specify a mask, then all fields are overwritten. + * @param {google.cloud.networksecurity.v1alpha1.AuthzPolicy} request.authzPolicy + * Required. `AuthzPolicy` resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/network_security.update_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthzPolicy_async + */ updateAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'authz_policy.name': request.authzPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'authz_policy.name': request.authzPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAuthzPolicy request %j', request); - return this.innerApiCalls.updateAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAuthzPolicy()`. - * @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/v1alpha1/network_security.update_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthzPolicy_async - */ - async checkUpdateAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAuthzPolicy()`. + * @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/v1alpha1/network_security.update_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_UpdateAuthzPolicy_async + */ + async checkUpdateAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single AuthzPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `AuthzPolicy` resource to delete. Must be in - * the format - * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server can ignore - * the request if it has already been completed. The server guarantees - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, ignores the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/network_security.delete_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthzPolicy_async - */ + /** + * Deletes a single AuthzPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `AuthzPolicy` resource to delete. Must be in + * the format + * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server can ignore + * the request if it has already been completed. The server guarantees + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, ignores the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/network_security.delete_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthzPolicy_async + */ deleteAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthzPolicy( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthzPolicy( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteAuthzPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAuthzPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAuthzPolicy request %j', request); - return this.innerApiCalls.deleteAuthzPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAuthzPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAuthzPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAuthzPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAuthzPolicy()`. - * @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/v1alpha1/network_security.delete_authz_policy.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthzPolicy_async - */ - async checkDeleteAuthzPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAuthzPolicy()`. + * @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/v1alpha1/network_security.delete_authz_policy.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_DeleteAuthzPolicy_async + */ + async checkDeleteAuthzPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteAuthzPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAuthzPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists AuthorizationPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. - * 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAuthzPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists AuthorizationPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. + * 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse, + ] + >; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAuthorizationPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -4725,204 +7335,233 @@ export class NetworkSecurityClient { this._log.info('listAuthorizationPolicies request %j', request); return this.innerApiCalls .listAuthorizationPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse - ]) => { - this._log.info('listAuthorizationPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesResponse, + ]) => { + this._log.info('listAuthorizationPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies stream %j', request); return this.descriptors.page.listAuthorizationPolicies.createStream( this.innerApiCalls.listAuthorizationPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. 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/v1alpha1/network_security.list_authorization_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListAuthorizationPolicies_async - */ + /** + * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.AuthorizationPolicy|AuthorizationPolicy}. 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/v1alpha1/network_security.list_authorization_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListAuthorizationPolicies_async + */ listAuthorizationPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies iterate %j', request); return this.descriptors.page.listAuthorizationPolicies.asyncIterate( this.innerApiCalls['listAuthorizationPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists BackendAuthenticationConfigs in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. - * 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 `listBackendAuthenticationConfigsAsync()` - * 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. - */ + /** + * Lists BackendAuthenticationConfigs in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. + * 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 `listBackendAuthenticationConfigsAsync()` + * 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. + */ listBackendAuthenticationConfigs( - request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse, + ] + >; listBackendAuthenticationConfigs( - request: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig + >, + ): void; listBackendAuthenticationConfigs( - request: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig + >, + ): void; listBackendAuthenticationConfigs( - request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listBackendAuthenticationConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -4931,209 +7570,243 @@ export class NetworkSecurityClient { this._log.info('listBackendAuthenticationConfigs request %j', request); return this.innerApiCalls .listBackendAuthenticationConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse - ]) => { - this._log.info('listBackendAuthenticationConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[], + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsResponse, + ]) => { + this._log.info( + 'listBackendAuthenticationConfigs values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listBackendAuthenticationConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig} 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 `listBackendAuthenticationConfigsAsync()` - * 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. - */ + /** + * Equivalent to `listBackendAuthenticationConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig} 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 `listBackendAuthenticationConfigsAsync()` + * 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. + */ listBackendAuthenticationConfigsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + 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['listBackendAuthenticationConfigs']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listBackendAuthenticationConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackendAuthenticationConfigs stream %j', request); return this.descriptors.page.listBackendAuthenticationConfigs.createStream( this.innerApiCalls.listBackendAuthenticationConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listBackendAuthenticationConfigs`, 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 project and location from which the - * BackendAuthenticationConfigs should be listed, specified in the format - * `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of BackendAuthenticationConfigs to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListBackendAuthenticationConfigsResponse` - * Indicates that this is a continuation of a prior - * `ListBackendAuthenticationConfigs` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. 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/v1alpha1/network_security.list_backend_authentication_configs.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListBackendAuthenticationConfigs_async - */ + /** + * Equivalent to `listBackendAuthenticationConfigs`, 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 project and location from which the + * BackendAuthenticationConfigs should be listed, specified in the format + * `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of BackendAuthenticationConfigs to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListBackendAuthenticationConfigsResponse` + * Indicates that this is a continuation of a prior + * `ListBackendAuthenticationConfigs` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.BackendAuthenticationConfig|BackendAuthenticationConfig}. 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/v1alpha1/network_security.list_backend_authentication_configs.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListBackendAuthenticationConfigs_async + */ listBackendAuthenticationConfigsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListBackendAuthenticationConfigsRequest, + 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['listBackendAuthenticationConfigs']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listBackendAuthenticationConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackendAuthenticationConfigs iterate %j', request); return this.descriptors.page.listBackendAuthenticationConfigs.asyncIterate( this.innerApiCalls['listBackendAuthenticationConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ServerTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. - * 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ServerTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. + * 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse, + ] + >; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listServerTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5142,213 +7815,242 @@ export class NetworkSecurityClient { this._log.info('listServerTlsPolicies request %j', request); return this.innerApiCalls .listServerTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse - ]) => { - this._log.info('listServerTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesResponse, + ]) => { + this._log.info('listServerTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies stream %j', request); return this.descriptors.page.listServerTlsPolicies.createStream( this.innerApiCalls.listServerTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @param {boolean} [request.returnPartialSuccess] - * Optional. Setting this field to `true` will opt the request into returning - * the resources that are reachable, and into including the names of those - * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] - * field. This can only be `true` when reading across collections e.g. when - * `parent` is set to `"projects/example/locations/-"`. - * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. 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/v1alpha1/network_security.list_server_tls_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListServerTlsPolicies_async - */ + /** + * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @param {boolean} [request.returnPartialSuccess] + * Optional. Setting this field to `true` will opt the request into returning + * the resources that are reachable, and into including the names of those + * that were unreachable in the [ListServerTlsPoliciesResponse.unreachable] + * field. This can only be `true` when reading across collections e.g. when + * `parent` is set to `"projects/example/locations/-"`. + * @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.networksecurity.v1alpha1.ServerTlsPolicy|ServerTlsPolicy}. 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/v1alpha1/network_security.list_server_tls_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListServerTlsPolicies_async + */ listServerTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies iterate %j', request); return this.descriptors.page.listServerTlsPolicies.asyncIterate( this.innerApiCalls['listServerTlsPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ClientTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. - * 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ClientTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. + * 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse, + ] + >; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listClientTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5357,202 +8059,231 @@ export class NetworkSecurityClient { this._log.info('listClientTlsPolicies request %j', request); return this.innerApiCalls .listClientTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse - ]) => { - this._log.info('listClientTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesResponse, + ]) => { + this._log.info('listClientTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies stream %j', request); return this.descriptors.page.listClientTlsPolicies.createStream( this.innerApiCalls.listClientTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. 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/v1alpha1/network_security.list_client_tls_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListClientTlsPolicies_async - */ + /** + * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.ClientTlsPolicy|ClientTlsPolicy}. 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/v1alpha1/network_security.list_client_tls_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListClientTlsPolicies_async + */ listClientTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies iterate %j', request); return this.descriptors.page.listClientTlsPolicies.asyncIterate( this.innerApiCalls['listClientTlsPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists GatewaySecurityPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. - * 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 `listGatewaySecurityPoliciesAsync()` - * 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. - */ + /** + * Lists GatewaySecurityPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. + * 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 `listGatewaySecurityPoliciesAsync()` + * 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. + */ listGatewaySecurityPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse, + ] + >; listGatewaySecurityPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy + >, + ): void; listGatewaySecurityPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy + >, + ): void; listGatewaySecurityPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGatewaySecurityPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5561,204 +8292,233 @@ export class NetworkSecurityClient { this._log.info('listGatewaySecurityPolicies request %j', request); return this.innerApiCalls .listGatewaySecurityPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse - ]) => { - this._log.info('listGatewaySecurityPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesResponse, + ]) => { + this._log.info('listGatewaySecurityPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGatewaySecurityPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy} 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 `listGatewaySecurityPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listGatewaySecurityPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy} 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 `listGatewaySecurityPoliciesAsync()` + * 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. + */ listGatewaySecurityPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGatewaySecurityPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicies stream %j', request); return this.descriptors.page.listGatewaySecurityPolicies.createStream( this.innerApiCalls.listGatewaySecurityPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGatewaySecurityPolicies`, 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 project and location from which the GatewaySecurityPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. 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/v1alpha1/network_security.list_gateway_security_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListGatewaySecurityPolicies_async - */ + /** + * Equivalent to `listGatewaySecurityPolicies`, 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 project and location from which the GatewaySecurityPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicy|GatewaySecurityPolicy}. 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/v1alpha1/network_security.list_gateway_security_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListGatewaySecurityPolicies_async + */ listGatewaySecurityPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGatewaySecurityPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicies iterate %j', request); return this.descriptors.page.listGatewaySecurityPolicies.asyncIterate( this.innerApiCalls['listGatewaySecurityPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists GatewaySecurityPolicyRules in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. - * 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 `listGatewaySecurityPolicyRulesAsync()` - * 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. - */ + /** + * Lists GatewaySecurityPolicyRules in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. + * 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 `listGatewaySecurityPolicyRulesAsync()` + * 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. + */ listGatewaySecurityPolicyRules( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse, + ] + >; listGatewaySecurityPolicyRules( - request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule + >, + ): void; listGatewaySecurityPolicyRules( - request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule + >, + ): void; listGatewaySecurityPolicyRules( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGatewaySecurityPolicyRules values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5767,204 +8527,235 @@ export class NetworkSecurityClient { this._log.info('listGatewaySecurityPolicyRules request %j', request); return this.innerApiCalls .listGatewaySecurityPolicyRules(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse - ]) => { - this._log.info('listGatewaySecurityPolicyRules values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[], + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesResponse, + ]) => { + this._log.info('listGatewaySecurityPolicyRules values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGatewaySecurityPolicyRules`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule} 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 `listGatewaySecurityPolicyRulesAsync()` - * 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. - */ + /** + * Equivalent to `listGatewaySecurityPolicyRules`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule} 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 `listGatewaySecurityPolicyRulesAsync()` + * 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. + */ listGatewaySecurityPolicyRulesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + 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['listGatewaySecurityPolicyRules']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listGatewaySecurityPolicyRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicyRules stream %j', request); return this.descriptors.page.listGatewaySecurityPolicyRules.createStream( this.innerApiCalls.listGatewaySecurityPolicyRules as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGatewaySecurityPolicyRules`, 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 project, location and GatewaySecurityPolicy from which the - * GatewaySecurityPolicyRules should be listed, specified in the format - * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. - * @param {number} request.pageSize - * Maximum number of GatewaySecurityPolicyRules to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a - * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. 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/v1alpha1/network_security.list_gateway_security_policy_rules.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListGatewaySecurityPolicyRules_async - */ + /** + * Equivalent to `listGatewaySecurityPolicyRules`, 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 project, location and GatewaySecurityPolicy from which the + * GatewaySecurityPolicyRules should be listed, specified in the format + * `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. + * @param {number} request.pageSize + * Maximum number of GatewaySecurityPolicyRules to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListGatewaySecurityPolicyRulesResponse' Indicates that this is a + * continuation of a prior 'ListGatewaySecurityPolicyRules' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.GatewaySecurityPolicyRule|GatewaySecurityPolicyRule}. 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/v1alpha1/network_security.list_gateway_security_policy_rules.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListGatewaySecurityPolicyRules_async + */ listGatewaySecurityPolicyRulesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListGatewaySecurityPolicyRulesRequest, + 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['listGatewaySecurityPolicyRules']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listGatewaySecurityPolicyRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGatewaySecurityPolicyRules iterate %j', request); return this.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate( this.innerApiCalls['listGatewaySecurityPolicyRules'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists UrlLists in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.UrlList|UrlList}. - * 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 `listUrlListsAsync()` - * 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. - */ + /** + * Lists UrlLists in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.UrlList|UrlList}. + * 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 `listUrlListsAsync()` + * 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. + */ listUrlLists( - request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IUrlList[], - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList[], + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse, + ] + >; listUrlLists( - request: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IUrlList>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IUrlList + >, + ): void; listUrlLists( - request: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IUrlList>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IUrlList + >, + ): void; listUrlLists( - request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IUrlList>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IUrlList>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IUrlList[], - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IUrlList + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IUrlList + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList[], + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IUrlList>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IUrlList + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listUrlLists values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5973,204 +8764,233 @@ export class NetworkSecurityClient { this._log.info('listUrlLists request %j', request); return this.innerApiCalls .listUrlLists(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IUrlList[], - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse - ]) => { - this._log.info('listUrlLists values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IUrlList[], + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListUrlListsResponse, + ]) => { + this._log.info('listUrlLists values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listUrlLists`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.UrlList|UrlList} 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 `listUrlListsAsync()` - * 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. - */ + /** + * Equivalent to `listUrlLists`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.UrlList|UrlList} 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 `listUrlListsAsync()` + * 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. + */ listUrlListsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUrlLists']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUrlLists stream %j', request); return this.descriptors.page.listUrlLists.createStream( this.innerApiCalls.listUrlLists as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listUrlLists`, 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 project and location from which the UrlLists should - * be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of UrlLists to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListUrlListsResponse` - * Indicates that this is a continuation of a prior - * `ListUrlLists` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1alpha1.UrlList|UrlList}. 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/v1alpha1/network_security.list_url_lists.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListUrlLists_async - */ + /** + * Equivalent to `listUrlLists`, 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 project and location from which the UrlLists should + * be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of UrlLists to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListUrlListsResponse` + * Indicates that this is a continuation of a prior + * `ListUrlLists` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1alpha1.UrlList|UrlList}. 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/v1alpha1/network_security.list_url_lists.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListUrlLists_async + */ listUrlListsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListUrlListsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUrlLists']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUrlLists iterate %j', request); return this.descriptors.page.listUrlLists.asyncIterate( this.innerApiCalls['listUrlLists'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists TlsInspectionPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. - * 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 `listTlsInspectionPoliciesAsync()` - * 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. - */ + /** + * Lists TlsInspectionPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. + * 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 `listTlsInspectionPoliciesAsync()` + * 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. + */ listTlsInspectionPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse, + ] + >; listTlsInspectionPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy + >, + ): void; listTlsInspectionPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy + >, + ): void; listTlsInspectionPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listTlsInspectionPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6179,206 +8999,235 @@ export class NetworkSecurityClient { this._log.info('listTlsInspectionPolicies request %j', request); return this.innerApiCalls .listTlsInspectionPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse - ]) => { - this._log.info('listTlsInspectionPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesResponse, + ]) => { + this._log.info('listTlsInspectionPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listTlsInspectionPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy} 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 `listTlsInspectionPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listTlsInspectionPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy} 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 `listTlsInspectionPoliciesAsync()` + * 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. + */ listTlsInspectionPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTlsInspectionPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTlsInspectionPolicies stream %j', request); return this.descriptors.page.listTlsInspectionPolicies.createStream( this.innerApiCalls.listTlsInspectionPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listTlsInspectionPolicies`, 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 project and location from which the TlsInspectionPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of TlsInspectionPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * 'ListTlsInspectionPoliciesResponse' Indicates that this is a - * continuation of a prior 'ListTlsInspectionPolicies' call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. 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/v1alpha1/network_security.list_tls_inspection_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListTlsInspectionPolicies_async - */ + /** + * Equivalent to `listTlsInspectionPolicies`, 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 project and location from which the TlsInspectionPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of TlsInspectionPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * 'ListTlsInspectionPoliciesResponse' Indicates that this is a + * continuation of a prior 'ListTlsInspectionPolicies' call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.TlsInspectionPolicy|TlsInspectionPolicy}. 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/v1alpha1/network_security.list_tls_inspection_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListTlsInspectionPolicies_async + */ listTlsInspectionPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListTlsInspectionPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTlsInspectionPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTlsInspectionPolicies iterate %j', request); return this.descriptors.page.listTlsInspectionPolicies.asyncIterate( this.innerApiCalls['listTlsInspectionPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists AuthzPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. - * 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 `listAuthzPoliciesAsync()` - * 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. - */ + /** + * Lists AuthzPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. + * 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 `listAuthzPoliciesAsync()` + * 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. + */ listAuthzPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse, + ] + >; listAuthzPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy + >, + ): void; listAuthzPolicies( - request: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy + >, + ): void; listAuthzPolicies( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAuthzPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6387,147 +9236,151 @@ export class NetworkSecurityClient { this._log.info('listAuthzPolicies request %j', request); return this.innerApiCalls .listAuthzPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse - ]) => { - this._log.info('listAuthzPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[], + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesResponse, + ]) => { + this._log.info('listAuthzPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAuthzPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy} 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 `listAuthzPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listAuthzPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy} 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 `listAuthzPoliciesAsync()` + * 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. + */ listAuthzPoliciesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthzPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthzPolicies stream %j', request); return this.descriptors.page.listAuthzPolicies.createStream( this.innerApiCalls.listAuthzPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAuthzPolicies`, 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 project and location from which the `AuthzPolicy` resources - * are listed, specified in the following format: - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server might return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results that the server returns. - * @param {string} [request.filter] - * Optional. Filtering results. - * @param {string} [request.orderBy] - * Optional. Hint for how to order the results. - * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. 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/v1alpha1/network_security.list_authz_policies.js - * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListAuthzPolicies_async - */ + /** + * Equivalent to `listAuthzPolicies`, 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 project and location from which the `AuthzPolicy` resources + * are listed, specified in the following format: + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server might return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results that the server returns. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @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.networksecurity.v1alpha1.AuthzPolicy|AuthzPolicy}. 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/v1alpha1/network_security.list_authz_policies.js + * region_tag:networksecurity_v1alpha1_generated_NetworkSecurity_ListAuthzPolicies_async + */ listAuthzPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListAuthzPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthzPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthzPolicies iterate %j', request); return this.descriptors.page.listAuthzPolicies.asyncIterate( this.innerApiCalls['listAuthzPolicies'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -6541,40 +9394,40 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -6588,41 +9441,41 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -6636,12 +9489,12 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -6676,12 +9529,11 @@ export class NetworkSecurityClient { | 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. @@ -6714,12 +9566,12 @@ export class NetworkSecurityClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -6762,22 +9614,22 @@ export class NetworkSecurityClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -6812,15 +9664,15 @@ export class NetworkSecurityClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -6854,7 +9706,7 @@ export class NetworkSecurityClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -6867,25 +9719,24 @@ export class NetworkSecurityClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -6924,22 +9775,22 @@ export class NetworkSecurityClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -6955,7 +9806,11 @@ export class NetworkSecurityClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -6971,7 +9826,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -6982,7 +9839,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -6992,8 +9851,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -7004,7 +9867,7 @@ export class NetworkSecurityClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -7020,7 +9883,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -7031,7 +9895,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -7042,7 +9907,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -7053,7 +9919,11 @@ export class NetworkSecurityClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -7068,8 +9938,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -7079,8 +9953,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -7090,8 +9968,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -7102,7 +9984,11 @@ export class NetworkSecurityClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -7118,7 +10004,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -7129,7 +10017,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -7140,7 +10030,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -7151,7 +10043,11 @@ export class NetworkSecurityClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -7167,7 +10063,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -7178,7 +10076,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -7188,8 +10088,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -7200,7 +10104,11 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -7215,8 +10123,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -7226,8 +10138,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -7237,8 +10153,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -7249,7 +10169,11 @@ export class NetworkSecurityClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -7265,7 +10189,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -7275,8 +10201,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -7286,8 +10216,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -7299,7 +10233,12 @@ export class NetworkSecurityClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -7315,8 +10254,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -7326,8 +10269,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -7337,8 +10284,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -7348,8 +10299,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -7360,7 +10315,11 @@ export class NetworkSecurityClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -7376,7 +10335,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -7387,7 +10348,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -7397,8 +10360,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -7409,7 +10376,11 @@ export class NetworkSecurityClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -7424,8 +10395,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -7435,8 +10410,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -7446,8 +10425,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -7458,7 +10441,11 @@ export class NetworkSecurityClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -7473,8 +10460,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -7484,8 +10475,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -7495,8 +10490,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -7507,12 +10506,18 @@ export class NetworkSecurityClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -7522,8 +10527,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -7533,8 +10542,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -7544,8 +10557,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -7556,7 +10573,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -7572,7 +10593,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -7583,7 +10606,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -7593,8 +10618,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -7605,7 +10634,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -7620,8 +10653,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -7631,8 +10668,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -7642,8 +10683,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -7654,7 +10699,11 @@ export class NetworkSecurityClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -7669,8 +10718,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -7680,8 +10733,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -7691,8 +10748,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -7703,12 +10764,18 @@ export class NetworkSecurityClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -7718,8 +10785,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -7729,8 +10800,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -7740,8 +10815,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -7752,12 +10831,18 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -7767,8 +10852,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -7778,8 +10867,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -7789,8 +10882,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -7801,12 +10898,18 @@ export class NetworkSecurityClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -7816,8 +10919,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -7827,8 +10934,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -7838,8 +10949,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -7850,12 +10965,18 @@ export class NetworkSecurityClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -7865,8 +10986,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -7876,8 +11001,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -7887,8 +11016,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -7899,7 +11032,11 @@ export class NetworkSecurityClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -7915,7 +11052,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -7926,7 +11065,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -7936,8 +11077,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -7948,7 +11093,11 @@ export class NetworkSecurityClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -7964,7 +11113,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -7975,7 +11126,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -7986,7 +11139,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -7997,12 +11152,18 @@ export class NetworkSecurityClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -8012,8 +11173,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -8023,8 +11188,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -8034,8 +11203,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -8046,12 +11219,18 @@ export class NetworkSecurityClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -8061,8 +11240,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -8072,8 +11255,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -8083,8 +11270,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -8095,12 +11286,18 @@ export class NetworkSecurityClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -8110,8 +11307,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -8121,8 +11322,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -8132,8 +11337,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -8144,7 +11353,7 @@ export class NetworkSecurityClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -8160,7 +11369,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -8171,7 +11381,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -8182,7 +11393,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -8193,7 +11405,7 @@ export class NetworkSecurityClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -8231,7 +11443,8 @@ export class NetworkSecurityClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -8242,7 +11455,11 @@ export class NetworkSecurityClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -8258,7 +11475,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -8269,7 +11488,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -8279,8 +11500,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -8291,7 +11516,11 @@ export class NetworkSecurityClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -8307,7 +11536,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -8318,7 +11549,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -8329,7 +11562,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -8340,7 +11575,11 @@ export class NetworkSecurityClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -8356,7 +11595,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -8367,7 +11608,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -8377,8 +11620,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -8389,7 +11636,7 @@ export class NetworkSecurityClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -8438,15 +11685,19 @@ export class NetworkSecurityClient { */ close(): Promise { if (this.networkSecurityStub && !this._terminated) { - return this.networkSecurityStub.then(stub => { + return this.networkSecurityStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/organization_security_profile_group_service_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/organization_security_profile_group_service_client.ts index d8113bc81a51..0b11132fc9b5 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/organization_security_profile_group_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/organization_security_profile_group_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class OrganizationSecurityProfileGroupServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,14 @@ export class OrganizationSecurityProfileGroupServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - organizationSecurityProfileGroupServiceStub?: Promise<{[name: string]: Function}>; + organizationSecurityProfileGroupServiceStub?: Promise<{ + [name: string]: Function; + }>; /** * Construct an instance of OrganizationSecurityProfileGroupServiceClient. @@ -103,21 +118,43 @@ export class OrganizationSecurityProfileGroupServiceClient { * const client = new OrganizationSecurityProfileGroupServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof OrganizationSecurityProfileGroupServiceClient; - 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 staticMembers = this + .constructor as typeof OrganizationSecurityProfileGroupServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +179,7 @@ export class OrganizationSecurityProfileGroupServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +192,14 @@ export class OrganizationSecurityProfileGroupServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,100 +221,108 @@ export class OrganizationSecurityProfileGroupServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' + 'organizations/{organization}', ), organizationLocationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'organizations/{organization}/locations/{location}', ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -289,10 +330,16 @@ export class OrganizationSecurityProfileGroupServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listSecurityProfileGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityProfileGroups'), - listSecurityProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'securityProfiles') + listSecurityProfileGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfileGroups', + ), + listSecurityProfiles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'securityProfiles', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -301,76 +348,226 @@ export class OrganizationSecurityProfileGroupServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup', + ) as gax.protobuf.Type; const createSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup', + ) as gax.protobuf.Type; const updateSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSecurityProfileGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSecurityProfileGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createSecurityProfileResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SecurityProfile') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SecurityProfile', + ) as gax.protobuf.Type; const createSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updateSecurityProfileResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SecurityProfile') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SecurityProfile', + ) as gax.protobuf.Type; const updateSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSecurityProfileResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSecurityProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createSecurityProfileGroupResponse.decode.bind(createSecurityProfileGroupResponse), - createSecurityProfileGroupMetadata.decode.bind(createSecurityProfileGroupMetadata)), + createSecurityProfileGroupResponse.decode.bind( + createSecurityProfileGroupResponse, + ), + createSecurityProfileGroupMetadata.decode.bind( + createSecurityProfileGroupMetadata, + ), + ), updateSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateSecurityProfileGroupResponse.decode.bind(updateSecurityProfileGroupResponse), - updateSecurityProfileGroupMetadata.decode.bind(updateSecurityProfileGroupMetadata)), + updateSecurityProfileGroupResponse.decode.bind( + updateSecurityProfileGroupResponse, + ), + updateSecurityProfileGroupMetadata.decode.bind( + updateSecurityProfileGroupMetadata, + ), + ), deleteSecurityProfileGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteSecurityProfileGroupResponse.decode.bind(deleteSecurityProfileGroupResponse), - deleteSecurityProfileGroupMetadata.decode.bind(deleteSecurityProfileGroupMetadata)), + deleteSecurityProfileGroupResponse.decode.bind( + deleteSecurityProfileGroupResponse, + ), + deleteSecurityProfileGroupMetadata.decode.bind( + deleteSecurityProfileGroupMetadata, + ), + ), createSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createSecurityProfileResponse.decode.bind(createSecurityProfileResponse), - createSecurityProfileMetadata.decode.bind(createSecurityProfileMetadata)), + createSecurityProfileResponse.decode.bind( + createSecurityProfileResponse, + ), + createSecurityProfileMetadata.decode.bind( + createSecurityProfileMetadata, + ), + ), updateSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateSecurityProfileResponse.decode.bind(updateSecurityProfileResponse), - updateSecurityProfileMetadata.decode.bind(updateSecurityProfileMetadata)), + updateSecurityProfileResponse.decode.bind( + updateSecurityProfileResponse, + ), + updateSecurityProfileMetadata.decode.bind( + updateSecurityProfileMetadata, + ), + ), deleteSecurityProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteSecurityProfileResponse.decode.bind(deleteSecurityProfileResponse), - deleteSecurityProfileMetadata.decode.bind(deleteSecurityProfileMetadata)) + deleteSecurityProfileResponse.decode.bind( + deleteSecurityProfileResponse, + ), + deleteSecurityProfileMetadata.decode.bind( + deleteSecurityProfileMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService', + 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 @@ -401,28 +598,45 @@ export class OrganizationSecurityProfileGroupServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService. this.organizationSecurityProfileGroupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.OrganizationSecurityProfileGroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .OrganizationSecurityProfileGroupService, + 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 organizationSecurityProfileGroupServiceStubMethods = - ['listSecurityProfileGroups', 'getSecurityProfileGroup', 'createSecurityProfileGroup', 'updateSecurityProfileGroup', 'deleteSecurityProfileGroup', 'listSecurityProfiles', 'getSecurityProfile', 'createSecurityProfile', 'updateSecurityProfile', 'deleteSecurityProfile']; + const organizationSecurityProfileGroupServiceStubMethods = [ + 'listSecurityProfileGroups', + 'getSecurityProfileGroup', + 'createSecurityProfileGroup', + 'updateSecurityProfileGroup', + 'deleteSecurityProfileGroup', + 'listSecurityProfiles', + 'getSecurityProfile', + 'createSecurityProfile', + 'updateSecurityProfile', + 'deleteSecurityProfile', + ]; for (const methodName of organizationSecurityProfileGroupServiceStubMethods) { const callPromise = this.organizationSecurityProfileGroupServiceStub.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) => () => { + (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] || @@ -432,7 +646,7 @@ export class OrganizationSecurityProfileGroupServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -447,8 +661,14 @@ export class OrganizationSecurityProfileGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -459,8 +679,14 @@ export class OrganizationSecurityProfileGroupServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -491,9 +717,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -502,8 +726,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -514,960 +739,1455 @@ export class OrganizationSecurityProfileGroupServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfileGroup to get. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. - * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. - * 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/v1alpha1/organization_security_profile_group_service.get_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfileGroup_async - */ + /** + * Gets details of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. + * 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/v1alpha1/organization_security_profile_group_service.get_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfileGroup_async + */ getSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ] + >; getSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSecurityProfileGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSecurityProfileGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSecurityProfileGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileGroupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfileGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfile to get. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. - * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. - * 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/v1alpha1/organization_security_profile_group_service.get_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfile_async - */ + /** + * Gets details of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to get. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. + * 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/v1alpha1/organization_security_profile_group_service.get_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_GetSecurityProfile_async + */ getSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ] + >; getSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSecurityProfile request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSecurityProfile response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSecurityProfile(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, - protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSecurityProfile response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSecurityProfileRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSecurityProfile response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new SecurityProfileGroup in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the SecurityProfileGroup. Must be in the - * format `projects|organizations/* /locations/{location}`. - * @param {string} request.securityProfileGroupId - * Required. Short name of the SecurityProfileGroup resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "security_profile_group1". - * @param {google.cloud.networksecurity.v1alpha1.SecurityProfileGroup} request.securityProfileGroup - * Required. SecurityProfileGroup resource to be created. - * @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/v1alpha1/organization_security_profile_group_service.create_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async - */ + /** + * Creates a new SecurityProfileGroup in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfileGroup. Must be in the + * format `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileGroupId + * Required. Short name of the SecurityProfileGroup resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "security_profile_group1". + * @param {google.cloud.networksecurity.v1alpha1.SecurityProfileGroup} request.securityProfileGroup + * Required. SecurityProfileGroup resource to be created. + * @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/v1alpha1/organization_security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async + */ createSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSecurityProfileGroup request %j', request); - return this.innerApiCalls.createSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSecurityProfileGroup()`. - * @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/v1alpha1/organization_security_profile_group_service.create_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async - */ - async checkCreateSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSecurityProfileGroup()`. + * @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/v1alpha1/organization_security_profile_group_service.create_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfileGroup_async + */ + async checkCreateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * SecurityProfileGroup resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * @param {google.cloud.networksecurity.v1alpha1.SecurityProfileGroup} request.securityProfileGroup - * Required. Updated SecurityProfileGroup 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/v1alpha1/organization_security_profile_group_service.update_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async - */ + /** + * Updates the parameters of a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfileGroup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1alpha1.SecurityProfileGroup} request.securityProfileGroup + * Required. Updated SecurityProfileGroup 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/v1alpha1/organization_security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ updateSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'security_profile_group.name': request.securityProfileGroup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'security_profile_group.name': request.securityProfileGroup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSecurityProfileGroup request %j', request); - return this.innerApiCalls.updateSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSecurityProfileGroup()`. - * @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/v1alpha1/organization_security_profile_group_service.update_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async - */ - async checkUpdateSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSecurityProfileGroup()`. + * @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/v1alpha1/organization_security_profile_group_service.update_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfileGroup_async + */ + async checkUpdateSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single SecurityProfileGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfileGroup to delete. Must be in the - * format - * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. - * @param {string} [request.etag] - * Optional. If client provided etag is out of date, delete will return - * FAILED_PRECONDITION error. - * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async - */ + /** + * Deletes a single SecurityProfileGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfileGroup to delete. Must be in the + * format + * `projects|organizations/* /locations/{location}/securityProfileGroups/{security_profile_group}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ deleteSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfileGroup( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfileGroup( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSecurityProfileGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSecurityProfileGroup request %j', request); - return this.innerApiCalls.deleteSecurityProfileGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSecurityProfileGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSecurityProfileGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfileGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSecurityProfileGroup()`. - * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile_group.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async - */ - async checkDeleteSecurityProfileGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSecurityProfileGroup()`. + * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile_group.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfileGroup_async + */ + async checkDeleteSecurityProfileGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteSecurityProfileGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSecurityProfileGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSecurityProfileGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new SecurityProfile in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the SecurityProfile. Must be in the format - * `projects|organizations/* /locations/{location}`. - * @param {string} request.securityProfileId - * Required. Short name of the SecurityProfile resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "security_profile1". - * @param {google.cloud.networksecurity.v1alpha1.SecurityProfile} request.securityProfile - * Required. SecurityProfile resource to be created. - * @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/v1alpha1/organization_security_profile_group_service.create_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async - */ + /** + * Creates a new SecurityProfile in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the SecurityProfile. Must be in the format + * `projects|organizations/* /locations/{location}`. + * @param {string} request.securityProfileId + * Required. Short name of the SecurityProfile resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "security_profile1". + * @param {google.cloud.networksecurity.v1alpha1.SecurityProfile} request.securityProfile + * Required. SecurityProfile resource to be created. + * @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/v1alpha1/organization_security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async + */ createSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSecurityProfile request %j', request); - return this.innerApiCalls.createSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSecurityProfile()`. - * @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/v1alpha1/organization_security_profile_group_service.create_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async - */ - async checkCreateSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSecurityProfile()`. + * @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/v1alpha1/organization_security_profile_group_service.create_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_CreateSecurityProfile_async + */ + async checkCreateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates the parameters of a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * SecurityProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * @param {google.cloud.networksecurity.v1alpha1.SecurityProfile} request.securityProfile - * Required. Updated SecurityProfile 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/v1alpha1/organization_security_profile_group_service.update_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async - */ + /** + * Updates the parameters of a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * SecurityProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.networksecurity.v1alpha1.SecurityProfile} request.securityProfile + * Required. Updated SecurityProfile 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/v1alpha1/organization_security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async + */ updateSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdateSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'security_profile.name': request.securityProfile!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'security_profile.name': request.securityProfile!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSecurityProfile request %j', request); - return this.innerApiCalls.updateSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSecurityProfile()`. - * @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/v1alpha1/organization_security_profile_group_service.update_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async - */ - async checkUpdateSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSecurityProfile()`. + * @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/v1alpha1/organization_security_profile_group_service.update_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_UpdateSecurityProfile_async + */ + async checkUpdateSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updateSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single SecurityProfile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the SecurityProfile to delete. Must be in the format - * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. - * @param {string} [request.etag] - * Optional. If client provided etag is out of date, delete will return - * FAILED_PRECONDITION error. - * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async - */ + /** + * Deletes a single SecurityProfile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the SecurityProfile to delete. Must be in the format + * `projects|organizations/* /locations/{location}/securityProfiles/{security_profile_id}`. + * @param {string} [request.etag] + * Optional. If client provided etag is out of date, delete will return + * FAILED_PRECONDITION error. + * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async + */ deleteSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfile( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSecurityProfile( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSecurityProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSecurityProfile response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSecurityProfile request %j', request); - return this.innerApiCalls.deleteSecurityProfile(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSecurityProfile response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSecurityProfile(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSecurityProfile response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSecurityProfile()`. - * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async - */ - async checkDeleteSecurityProfileProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSecurityProfile()`. + * @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/v1alpha1/organization_security_profile_group_service.delete_security_profile.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_DeleteSecurityProfile_async + */ + async checkDeleteSecurityProfileProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteSecurityProfile long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSecurityProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists SecurityProfileGroups in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfileGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. - * 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 `listSecurityProfileGroupsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSecurityProfile, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists SecurityProfileGroups in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfileGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. + * 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 `listSecurityProfileGroupsAsync()` + * 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. + */ listSecurityProfileGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse, + ] + >; listSecurityProfileGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup + >, + ): void; listSecurityProfileGroups( - request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup + >, + ): void; listSecurityProfileGroups( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSecurityProfileGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1476,204 +2196,233 @@ export class OrganizationSecurityProfileGroupServiceClient { this._log.info('listSecurityProfileGroups request %j', request); return this.innerApiCalls .listSecurityProfileGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse - ]) => { - this._log.info('listSecurityProfileGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsResponse, + ]) => { + this._log.info('listSecurityProfileGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSecurityProfileGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfileGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup} 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 `listSecurityProfileGroupsAsync()` - * 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. - */ + /** + * Equivalent to `listSecurityProfileGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfileGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup} 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 `listSecurityProfileGroupsAsync()` + * 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. + */ listSecurityProfileGroupsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfileGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfileGroups stream %j', request); return this.descriptors.page.listSecurityProfileGroups.createStream( this.innerApiCalls.listSecurityProfileGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSecurityProfileGroups`, 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 project or organization and location from which the - * SecurityProfileGroups should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfileGroups to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfileGroupsResponse` Indicates that this is a - * continuation of a prior `ListSecurityProfileGroups` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. 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/v1alpha1/organization_security_profile_group_service.list_security_profile_groups.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfileGroups_async - */ + /** + * Equivalent to `listSecurityProfileGroups`, 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 project or organization and location from which the + * SecurityProfileGroups should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfileGroups to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfileGroupsResponse` Indicates that this is a + * continuation of a prior `ListSecurityProfileGroups` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1alpha1.SecurityProfileGroup|SecurityProfileGroup}. 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/v1alpha1/organization_security_profile_group_service.list_security_profile_groups.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfileGroups_async + */ listSecurityProfileGroupsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfileGroupsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfileGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfileGroups iterate %j', request); return this.descriptors.page.listSecurityProfileGroups.asyncIterate( this.innerApiCalls['listSecurityProfileGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists SecurityProfiles in a given organization and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfiles to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. - * 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 `listSecurityProfilesAsync()` - * 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. - */ + /** + * Lists SecurityProfiles in a given organization and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfiles to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. + * 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 `listSecurityProfilesAsync()` + * 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. + */ listSecurityProfiles( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse, + ] + >; listSecurityProfiles( - request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile + >, + ): void; listSecurityProfiles( - request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile + >, + ): void; listSecurityProfiles( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSecurityProfiles values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1682,143 +2431,147 @@ export class OrganizationSecurityProfileGroupServiceClient { this._log.info('listSecurityProfiles request %j', request); return this.innerApiCalls .listSecurityProfiles(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse - ]) => { - this._log.info('listSecurityProfiles values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[], + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesResponse, + ]) => { + this._log.info('listSecurityProfiles values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSecurityProfiles`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfiles to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile} 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 `listSecurityProfilesAsync()` - * 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. - */ + /** + * Equivalent to `listSecurityProfiles`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfiles to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile} 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 `listSecurityProfilesAsync()` + * 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. + */ listSecurityProfilesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfiles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfiles stream %j', request); return this.descriptors.page.listSecurityProfiles.createStream( this.innerApiCalls.listSecurityProfiles as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSecurityProfiles`, 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 project or organization and location from which the - * SecurityProfiles should be listed, specified in the format - * `projects|organizations/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of SecurityProfiles to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListSecurityProfilesResponse` Indicates that this is a continuation of a - * prior `ListSecurityProfiles` call, and that the system should return the - * next page of data. - * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. 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/v1alpha1/organization_security_profile_group_service.list_security_profiles.js - * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfiles_async - */ + /** + * Equivalent to `listSecurityProfiles`, 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 project or organization and location from which the + * SecurityProfiles should be listed, specified in the format + * `projects|organizations/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of SecurityProfiles to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListSecurityProfilesResponse` Indicates that this is a continuation of a + * prior `ListSecurityProfiles` call, and that the system should return the + * next page of data. + * @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.networksecurity.v1alpha1.SecurityProfile|SecurityProfile}. 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/v1alpha1/organization_security_profile_group_service.list_security_profiles.js + * region_tag:networksecurity_v1alpha1_generated_OrganizationSecurityProfileGroupService_ListSecurityProfiles_async + */ listSecurityProfilesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSecurityProfilesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSecurityProfiles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSecurityProfiles iterate %j', request); return this.descriptors.page.listSecurityProfiles.asyncIterate( this.innerApiCalls['listSecurityProfiles'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1832,40 +2585,40 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1879,41 +2632,41 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1927,12 +2680,12 @@ export class OrganizationSecurityProfileGroupServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1967,12 +2720,11 @@ export class OrganizationSecurityProfileGroupServiceClient { | 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. @@ -2005,12 +2757,12 @@ export class OrganizationSecurityProfileGroupServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2053,22 +2805,22 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2103,15 +2855,15 @@ export class OrganizationSecurityProfileGroupServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2145,7 +2897,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2158,25 +2910,24 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2215,22 +2966,22 @@ export class OrganizationSecurityProfileGroupServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2246,7 +2997,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2262,7 +3017,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2273,7 +3030,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2283,8 +3042,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2295,7 +3058,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2311,7 +3074,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2322,7 +3086,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2333,7 +3098,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2344,7 +3110,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2359,8 +3129,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2370,8 +3144,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2381,8 +3159,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2393,7 +3175,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2409,7 +3195,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2420,7 +3208,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2431,7 +3221,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2442,7 +3234,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2458,7 +3254,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2469,7 +3267,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2479,8 +3279,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2491,7 +3295,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2506,8 +3314,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2517,8 +3329,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2528,8 +3344,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2540,7 +3360,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2556,7 +3380,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2566,8 +3392,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2577,8 +3407,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2590,7 +3424,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2606,8 +3445,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2617,8 +3460,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2628,8 +3475,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2639,8 +3490,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2651,7 +3506,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2667,7 +3526,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2678,7 +3539,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2688,8 +3551,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2700,7 +3567,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2715,8 +3586,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2726,8 +3601,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2737,8 +3616,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2749,7 +3632,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2764,8 +3651,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2775,8 +3666,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2786,8 +3681,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2798,12 +3697,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2813,8 +3718,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2824,8 +3733,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2835,8 +3748,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2847,7 +3764,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2863,7 +3784,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2874,7 +3797,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2884,8 +3809,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -2896,7 +3825,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2911,8 +3844,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -2922,8 +3859,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -2933,8 +3874,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -2945,7 +3890,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2960,8 +3909,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2971,8 +3924,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -2982,8 +3939,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -2994,12 +3955,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3009,8 +3976,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3020,8 +3991,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3031,8 +4006,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3041,7 +4020,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} organization * @returns {string} Resource name string. */ - organizationPath(organization:string) { + organizationPath(organization: string) { return this.pathTemplates.organizationPathTemplate.render({ organization: organization, }); @@ -3055,7 +4034,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; } /** @@ -3065,7 +4045,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} location * @returns {string} Resource name string. */ - organizationLocationPath(organization:string,location:string) { + organizationLocationPath(organization: string, location: string) { return this.pathTemplates.organizationLocationPathTemplate.render({ organization: organization, location: location, @@ -3079,8 +4059,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing OrganizationLocation resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).organization; + matchOrganizationFromOrganizationLocationName( + organizationLocationName: string, + ) { + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).organization; } /** @@ -3091,7 +4075,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromOrganizationLocationName(organizationLocationName: string) { - return this.pathTemplates.organizationLocationPathTemplate.match(organizationLocationName).location; + return this.pathTemplates.organizationLocationPathTemplate.match( + organizationLocationName, + ).location; } /** @@ -3102,12 +4088,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3117,8 +4109,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3128,8 +4124,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3139,8 +4139,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3151,12 +4155,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3166,8 +4176,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3177,8 +4191,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3188,8 +4206,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3200,12 +4222,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3215,8 +4243,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3226,8 +4258,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3237,8 +4273,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3249,7 +4289,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -3265,7 +4309,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -3276,7 +4322,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -3286,8 +4334,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -3298,7 +4350,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -3314,7 +4370,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -3325,7 +4383,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -3336,7 +4396,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -3347,12 +4409,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3362,8 +4430,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3373,8 +4445,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3384,8 +4460,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3396,12 +4476,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3411,8 +4497,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3422,8 +4512,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3433,8 +4527,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3445,12 +4543,18 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3460,8 +4564,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3471,8 +4579,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3482,8 +4594,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3494,7 +4610,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -3510,7 +4626,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -3521,7 +4638,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -3532,7 +4650,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -3543,7 +4662,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -3581,7 +4700,8 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3592,7 +4712,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -3608,7 +4732,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -3619,7 +4745,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -3629,8 +4757,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -3641,7 +4773,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3657,7 +4793,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3668,7 +4806,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3679,7 +4819,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3690,7 +4832,11 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3706,7 +4852,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3717,7 +4865,9 @@ export class OrganizationSecurityProfileGroupServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3727,8 +4877,12 @@ export class OrganizationSecurityProfileGroupServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3739,7 +4893,7 @@ export class OrganizationSecurityProfileGroupServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3788,15 +4942,19 @@ export class OrganizationSecurityProfileGroupServiceClient { */ close(): Promise { if (this.organizationSecurityProfileGroupServiceStub && !this._terminated) { - return this.organizationSecurityProfileGroupServiceStub.then(stub => { + return this.organizationSecurityProfileGroupServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_gateway_service_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_gateway_service_client.ts index 9ce21b8dfe97..f8fd454522d7 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_gateway_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_gateway_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class SSEGatewayServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class SSEGatewayServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - sSEGatewayServiceStub?: Promise<{[name: string]: Function}>; + sSEGatewayServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SSEGatewayServiceClient. @@ -103,21 +116,42 @@ export class SSEGatewayServiceClient { * const client = new SSEGatewayServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SSEGatewayServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class SSEGatewayServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class SSEGatewayServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,100 +218,108 @@ export class SSEGatewayServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -289,10 +327,16 @@ export class SSEGatewayServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listPartnerSSEGateways: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'partnerSseGateways'), - listSSEGatewayReferences: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sseGatewayReferences') + listPartnerSSEGateways: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'partnerSseGateways', + ), + listSSEGatewayReferences: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sseGatewayReferences', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -301,52 +345,181 @@ export class SSEGatewayServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createPartnerSSEGatewayResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway', + ) as gax.protobuf.Type; const createPartnerSSEGatewayMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deletePartnerSSEGatewayResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deletePartnerSSEGatewayMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const updatePartnerSSEGatewayResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway', + ) as gax.protobuf.Type; const updatePartnerSSEGatewayMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createPartnerSSEGateway: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createPartnerSSEGatewayResponse.decode.bind(createPartnerSSEGatewayResponse), - createPartnerSSEGatewayMetadata.decode.bind(createPartnerSSEGatewayMetadata)), + createPartnerSSEGatewayResponse.decode.bind( + createPartnerSSEGatewayResponse, + ), + createPartnerSSEGatewayMetadata.decode.bind( + createPartnerSSEGatewayMetadata, + ), + ), deletePartnerSSEGateway: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deletePartnerSSEGatewayResponse.decode.bind(deletePartnerSSEGatewayResponse), - deletePartnerSSEGatewayMetadata.decode.bind(deletePartnerSSEGatewayMetadata)), + deletePartnerSSEGatewayResponse.decode.bind( + deletePartnerSSEGatewayResponse, + ), + deletePartnerSSEGatewayMetadata.decode.bind( + deletePartnerSSEGatewayMetadata, + ), + ), updatePartnerSSEGateway: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updatePartnerSSEGatewayResponse.decode.bind(updatePartnerSSEGatewayResponse), - updatePartnerSSEGatewayMetadata.decode.bind(updatePartnerSSEGatewayMetadata)) + updatePartnerSSEGatewayResponse.decode.bind( + updatePartnerSSEGatewayResponse, + ), + updatePartnerSSEGatewayMetadata.decode.bind( + updatePartnerSSEGatewayMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.SSEGatewayService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.SSEGatewayService', + 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 @@ -377,28 +550,42 @@ export class SSEGatewayServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.SSEGatewayService. this.sSEGatewayServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.SSEGatewayService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.SSEGatewayService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.SSEGatewayService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .SSEGatewayService, + 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 sSEGatewayServiceStubMethods = - ['listPartnerSseGateways', 'getPartnerSseGateway', 'createPartnerSseGateway', 'deletePartnerSseGateway', 'updatePartnerSseGateway', 'listSseGatewayReferences', 'getSseGatewayReference']; + const sSEGatewayServiceStubMethods = [ + 'listPartnerSseGateways', + 'getPartnerSseGateway', + 'createPartnerSseGateway', + 'deletePartnerSseGateway', + 'updatePartnerSseGateway', + 'listSseGatewayReferences', + 'getSseGatewayReference', + ]; for (const methodName of sSEGatewayServiceStubMethods) { const callPromise = this.sSEGatewayServiceStub.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) => () => { + (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] || @@ -408,7 +595,7 @@ export class SSEGatewayServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -423,8 +610,14 @@ export class SSEGatewayServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -435,8 +628,14 @@ export class SSEGatewayServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -467,9 +666,7 @@ export class SSEGatewayServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -478,8 +675,9 @@ export class SSEGatewayServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -490,652 +688,961 @@ export class SSEGatewayServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single PartnerSSEGateway. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. - * 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/v1alpha1/s_s_e_gateway_service.get_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_GetPartnerSSEGateway_async - */ + /** + * Gets details of a single PartnerSSEGateway. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. + * 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/v1alpha1/s_s_e_gateway_service.get_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_GetPartnerSSEGateway_async + */ getPartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | undefined + ), + {} | undefined, + ] + >; getPartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getPartnerSSEGateway request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getPartnerSSEGateway response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getPartnerSseGateway(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest|undefined, - {}|undefined - ]) => { - this._log.info('getPartnerSSEGateway response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getPartnerSseGateway(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSEGatewayRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getPartnerSSEGateway response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single SSEGatewayReference. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. - * 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/v1alpha1/s_s_e_gateway_service.get_s_s_e_gateway_reference.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_GetSSEGatewayReference_async - */ + /** + * Gets details of a single SSEGatewayReference. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. + * 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/v1alpha1/s_s_e_gateway_service.get_s_s_e_gateway_reference.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_GetSSEGatewayReference_async + */ getSSEGatewayReference( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | undefined + ), + {} | undefined, + ] + >; getSSEGatewayReference( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSSEGatewayReference( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSSEGatewayReference( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSSEGatewayReference request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSSEGatewayReference response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSseGatewayReference(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, - protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSSEGatewayReference response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSseGatewayReference(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSSEGatewayReferenceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSSEGatewayReference response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new PartnerSSEGateway in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.partnerSseGatewayId - * Required. Id of the requesting object - * If auto-generating Id server-side, remove this field and - * partner_sse_gateway_id from the method_signature of Create RPC - * @param {google.cloud.networksecurity.v1alpha1.PartnerSSEGateway} request.partnerSseGateway - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_gateway_service.create_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_CreatePartnerSSEGateway_async - */ + /** + * Creates a new PartnerSSEGateway in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.partnerSseGatewayId + * Required. Id of the requesting object + * If auto-generating Id server-side, remove this field and + * partner_sse_gateway_id from the method_signature of Create RPC + * @param {google.cloud.networksecurity.v1alpha1.PartnerSSEGateway} request.partnerSseGateway + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_gateway_service.create_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_CreatePartnerSSEGateway_async + */ createPartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createPartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSEGatewayRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createPartnerSSEGateway response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createPartnerSSEGateway request %j', request); - return this.innerApiCalls.createPartnerSseGateway(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createPartnerSSEGateway response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createPartnerSseGateway(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createPartnerSSEGateway response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createPartnerSSEGateway()`. - * @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/v1alpha1/s_s_e_gateway_service.create_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_CreatePartnerSSEGateway_async - */ - async checkCreatePartnerSSEGatewayProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createPartnerSSEGateway()`. + * @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/v1alpha1/s_s_e_gateway_service.create_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_CreatePartnerSSEGateway_async + */ + async checkCreatePartnerSSEGatewayProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createPartnerSSEGateway long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createPartnerSSEGateway, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createPartnerSSEGateway, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single PartnerSSEGateway. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_gateway_service.delete_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_DeletePartnerSSEGateway_async - */ + /** + * Deletes a single PartnerSSEGateway. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_gateway_service.delete_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_DeletePartnerSSEGateway_async + */ deletePartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deletePartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSEGatewayRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deletePartnerSSEGateway response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deletePartnerSSEGateway request %j', request); - return this.innerApiCalls.deletePartnerSseGateway(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deletePartnerSSEGateway response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deletePartnerSseGateway(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deletePartnerSSEGateway response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deletePartnerSSEGateway()`. - * @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/v1alpha1/s_s_e_gateway_service.delete_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_DeletePartnerSSEGateway_async - */ - async checkDeletePartnerSSEGatewayProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deletePartnerSSEGateway()`. + * @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/v1alpha1/s_s_e_gateway_service.delete_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_DeletePartnerSSEGateway_async + */ + async checkDeletePartnerSSEGatewayProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deletePartnerSSEGateway long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deletePartnerSSEGateway, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deletePartnerSSEGateway, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Updates a single PartnerSSEGateway. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.networksecurity.v1alpha1.PartnerSSEGateway} request.partnerSseGateway - * Required. The resource being created - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to update - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_gateway_service.update_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_UpdatePartnerSSEGateway_async - */ + /** + * Updates a single PartnerSSEGateway. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.networksecurity.v1alpha1.PartnerSSEGateway} request.partnerSseGateway + * Required. The resource being created + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to update + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_gateway_service.update_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_UpdatePartnerSSEGateway_async + */ updatePartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updatePartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePartnerSSEGateway( - request: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePartnerSSEGateway( - request?: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IUpdatePartnerSSEGatewayRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'partner_sse_gateway.name': request.partnerSseGateway!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'partner_sse_gateway.name': request.partnerSseGateway!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updatePartnerSSEGateway response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updatePartnerSSEGateway request %j', request); - return this.innerApiCalls.updatePartnerSseGateway(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updatePartnerSSEGateway response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updatePartnerSseGateway(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updatePartnerSSEGateway response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updatePartnerSSEGateway()`. - * @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/v1alpha1/s_s_e_gateway_service.update_partner_s_s_e_gateway.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_UpdatePartnerSSEGateway_async - */ - async checkUpdatePartnerSSEGatewayProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updatePartnerSSEGateway()`. + * @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/v1alpha1/s_s_e_gateway_service.update_partner_s_s_e_gateway.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_UpdatePartnerSSEGateway_async + */ + async checkUpdatePartnerSSEGatewayProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('updatePartnerSSEGateway long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updatePartnerSSEGateway, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists PartnerSSEGateways in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPartnerSSEGatewaysRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. - * 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 `listPartnerSSEGatewaysAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updatePartnerSSEGateway, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists PartnerSSEGateways in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPartnerSSEGatewaysRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. + * 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 `listPartnerSSEGatewaysAsync()` + * 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. + */ listPartnerSSEGateways( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse, + ] + >; listPartnerSSEGateways( - request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway + >, + ): void; listPartnerSSEGateways( - request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway + >, + ): void; listPartnerSSEGateways( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPartnerSSEGateways values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1144,204 +1651,233 @@ export class SSEGatewayServiceClient { this._log.info('listPartnerSSEGateways request %j', request); return this.innerApiCalls .listPartnerSseGateways(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse - ]) => { - this._log.info('listPartnerSSEGateways values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysResponse, + ]) => { + this._log.info('listPartnerSSEGateways values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPartnerSSEGateways`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPartnerSSEGatewaysRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway} 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 `listPartnerSSEGatewaysAsync()` - * 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. - */ + /** + * Equivalent to `listPartnerSSEGateways`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPartnerSSEGatewaysRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway} 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 `listPartnerSSEGatewaysAsync()` + * 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. + */ listPartnerSSEGatewaysStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPartnerSseGateways']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPartnerSSEGateways stream %j', request); return this.descriptors.page.listPartnerSSEGateways.createStream( this.innerApiCalls.listPartnerSseGateways as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPartnerSSEGateways`, 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. Parent value for ListPartnerSSEGatewaysRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. 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/v1alpha1/s_s_e_gateway_service.list_partner_s_s_e_gateways.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_ListPartnerSSEGateways_async - */ + /** + * Equivalent to `listPartnerSSEGateways`, 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. Parent value for ListPartnerSSEGatewaysRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSEGateway|PartnerSSEGateway}. 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/v1alpha1/s_s_e_gateway_service.list_partner_s_s_e_gateways.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_ListPartnerSSEGateways_async + */ listPartnerSSEGatewaysAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSEGatewaysRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPartnerSseGateways']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPartnerSSEGateways iterate %j', request); return this.descriptors.page.listPartnerSSEGateways.asyncIterate( this.innerApiCalls['listPartnerSseGateways'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists SSEGatewayReferences in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListSSEGatewayReferencesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. - * 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 `listSSEGatewayReferencesAsync()` - * 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. - */ + /** + * Lists SSEGatewayReferences in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListSSEGatewayReferencesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. + * 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 `listSSEGatewayReferencesAsync()` + * 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. + */ listSSEGatewayReferences( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse, + ] + >; listSSEGatewayReferences( - request: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference + >, + ): void; listSSEGatewayReferences( - request: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference + >, + ): void; listSSEGatewayReferences( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSSEGatewayReferences values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1350,143 +1886,147 @@ export class SSEGatewayServiceClient { this._log.info('listSSEGatewayReferences request %j', request); return this.innerApiCalls .listSseGatewayReferences(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse - ]) => { - this._log.info('listSSEGatewayReferences values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[], + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesResponse, + ]) => { + this._log.info('listSSEGatewayReferences values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSSEGatewayReferences`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListSSEGatewayReferencesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference} 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 `listSSEGatewayReferencesAsync()` - * 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. - */ + /** + * Equivalent to `listSSEGatewayReferences`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListSSEGatewayReferencesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference} 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 `listSSEGatewayReferencesAsync()` + * 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. + */ listSSEGatewayReferencesStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSseGatewayReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSSEGatewayReferences stream %j', request); return this.descriptors.page.listSSEGatewayReferences.createStream( this.innerApiCalls.listSseGatewayReferences as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSSEGatewayReferences`, 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. Parent value for ListSSEGatewayReferencesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. 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/v1alpha1/s_s_e_gateway_service.list_s_s_e_gateway_references.js - * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_ListSSEGatewayReferences_async - */ + /** + * Equivalent to `listSSEGatewayReferences`, 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. Parent value for ListSSEGatewayReferencesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.SSEGatewayReference|SSEGatewayReference}. 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/v1alpha1/s_s_e_gateway_service.list_s_s_e_gateway_references.js + * region_tag:networksecurity_v1alpha1_generated_SSEGatewayService_ListSSEGatewayReferences_async + */ listSSEGatewayReferencesAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSSEGatewayReferencesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSseGatewayReferences']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSSEGatewayReferences iterate %j', request); return this.descriptors.page.listSSEGatewayReferences.asyncIterate( this.innerApiCalls['listSseGatewayReferences'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -1500,40 +2040,40 @@ export class SSEGatewayServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1547,41 +2087,41 @@ export class SSEGatewayServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1595,12 +2135,12 @@ export class SSEGatewayServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1635,12 +2175,11 @@ export class SSEGatewayServiceClient { | 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. @@ -1673,12 +2212,12 @@ export class SSEGatewayServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -1721,22 +2260,22 @@ export class SSEGatewayServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -1771,15 +2310,15 @@ export class SSEGatewayServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -1813,7 +2352,7 @@ export class SSEGatewayServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -1826,25 +2365,24 @@ export class SSEGatewayServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -1883,22 +2421,22 @@ export class SSEGatewayServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -1914,7 +2452,11 @@ export class SSEGatewayServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -1930,7 +2472,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -1941,7 +2485,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -1951,8 +2497,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -1963,7 +2513,7 @@ export class SSEGatewayServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -1979,7 +2529,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -1990,7 +2541,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2001,7 +2553,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2012,7 +2565,11 @@ export class SSEGatewayServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2027,8 +2584,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2038,8 +2599,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2049,8 +2614,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2061,7 +2630,11 @@ export class SSEGatewayServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2077,7 +2650,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2088,7 +2663,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2099,7 +2676,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2110,7 +2689,11 @@ export class SSEGatewayServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2126,7 +2709,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2137,7 +2722,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2147,8 +2734,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2159,7 +2750,11 @@ export class SSEGatewayServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2174,8 +2769,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2185,8 +2784,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2196,8 +2799,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2208,7 +2815,11 @@ export class SSEGatewayServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2224,7 +2835,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2234,8 +2847,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2245,8 +2862,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2258,7 +2879,12 @@ export class SSEGatewayServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2274,8 +2900,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -2285,8 +2915,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -2296,8 +2930,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -2307,8 +2945,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -2319,7 +2961,11 @@ export class SSEGatewayServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -2335,7 +2981,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -2346,7 +2994,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -2356,8 +3006,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -2368,7 +3022,11 @@ export class SSEGatewayServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2383,8 +3041,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -2394,8 +3056,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -2405,8 +3071,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -2417,7 +3087,11 @@ export class SSEGatewayServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2432,8 +3106,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -2443,8 +3121,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -2454,8 +3136,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -2466,12 +3152,18 @@ export class SSEGatewayServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -2481,8 +3173,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -2492,8 +3188,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -2503,8 +3203,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -2514,7 +3218,7 @@ export class SSEGatewayServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2551,7 +3255,11 @@ export class SSEGatewayServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -2567,7 +3275,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -2578,7 +3288,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -2588,8 +3300,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -2600,7 +3316,11 @@ export class SSEGatewayServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -2615,8 +3335,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -2626,8 +3350,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -2637,8 +3365,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -2649,7 +3381,11 @@ export class SSEGatewayServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -2664,8 +3400,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -2675,8 +3415,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -2686,8 +3430,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -2698,12 +3446,18 @@ export class SSEGatewayServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -2713,8 +3467,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -2724,8 +3482,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -2735,8 +3497,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -2747,12 +3513,18 @@ export class SSEGatewayServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -2762,8 +3534,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -2773,8 +3549,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -2784,8 +3564,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -2796,12 +3580,18 @@ export class SSEGatewayServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -2811,8 +3601,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -2822,8 +3616,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -2833,8 +3631,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -2845,12 +3647,18 @@ export class SSEGatewayServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -2860,8 +3668,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -2871,8 +3683,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -2882,8 +3698,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -2894,7 +3714,11 @@ export class SSEGatewayServiceClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -2910,7 +3734,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -2921,7 +3747,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -2931,8 +3759,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -2943,7 +3775,11 @@ export class SSEGatewayServiceClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -2959,7 +3795,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -2970,7 +3808,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -2981,7 +3821,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -2990,7 +3832,7 @@ export class SSEGatewayServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3015,12 +3857,18 @@ export class SSEGatewayServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3030,8 +3878,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3041,8 +3893,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3052,8 +3908,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3064,12 +3924,18 @@ export class SSEGatewayServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3079,8 +3945,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3090,8 +3960,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3101,8 +3975,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3113,12 +3991,18 @@ export class SSEGatewayServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3128,8 +4012,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3139,8 +4027,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3150,8 +4042,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3162,7 +4058,7 @@ export class SSEGatewayServiceClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -3178,7 +4074,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -3189,7 +4086,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -3200,7 +4098,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -3211,7 +4110,7 @@ export class SSEGatewayServiceClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -3249,7 +4148,8 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3260,7 +4160,11 @@ export class SSEGatewayServiceClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -3276,7 +4180,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -3287,7 +4193,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -3297,8 +4205,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -3309,7 +4221,11 @@ export class SSEGatewayServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -3325,7 +4241,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -3336,7 +4254,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -3347,7 +4267,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3358,7 +4280,11 @@ export class SSEGatewayServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -3374,7 +4300,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -3385,7 +4313,9 @@ export class SSEGatewayServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -3395,8 +4325,12 @@ export class SSEGatewayServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -3407,7 +4341,7 @@ export class SSEGatewayServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -3456,15 +4390,19 @@ export class SSEGatewayServiceClient { */ close(): Promise { if (this.sSEGatewayServiceStub && !this._terminated) { - return this.sSEGatewayServiceStub.then(stub => { + return this.sSEGatewayServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_realm_service_client.ts b/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_realm_service_client.ts index 7b10f2ffca88..f03dee94771e 100644 --- a/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_realm_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1alpha1/s_s_e_realm_service_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class SSERealmServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,12 +70,12 @@ export class SSERealmServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - sSERealmServiceStub?: Promise<{[name: string]: Function}>; + sSERealmServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SSERealmServiceClient. @@ -103,21 +116,42 @@ export class SSERealmServiceClient { * const client = new SSERealmServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SSERealmServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -142,7 +176,7 @@ export class SSERealmServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class SSERealmServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,100 +218,108 @@ export class SSERealmServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), authzPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}' + 'projects/{project}/locations/{location}/authzPolicies/{authz_policy}', ), backendAuthenticationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}' + 'projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), firewallEndpointAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}' + 'projects/{project}/locations/{location}/firewallEndpointAssociations/{firewall_endpoint_association}', ), gatewaySecurityPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}', ), gatewaySecurityPolicyRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}' + 'projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}', ), interceptDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}' + 'projects/{project}/locations/{location}/interceptDeployments/{intercept_deployment}', ), interceptDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}' + 'projects/{project}/locations/{location}/interceptDeploymentGroups/{intercept_deployment_group}', ), interceptEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}' - ), - interceptEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}' + 'projects/{project}/locations/{location}/interceptEndpointGroups/{intercept_endpoint_group}', ), + interceptEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association}', + ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), mirroringDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}' + 'projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}', ), mirroringDeploymentGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}' + 'projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}', ), mirroringEndpointGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}' - ), - mirroringEndpointGroupAssociationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}' - ), - organizationLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - organizationLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}' - ), - organizationLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}', ), + mirroringEndpointGroupAssociationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}', + ), + organizationLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + organizationLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfiles/{security_profile}', + ), + organizationLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), partnerSSEGatewayPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}' + 'projects/{project}/locations/{location}/partnerSSEGateways/{partner_sse_gateway}', ), partnerSSERealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}' + 'projects/{project}/locations/{location}/partnerSSERealms/{partner_sse_realm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationFirewallEndpointsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}' - ), - projectLocationSecurityProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfiles/{security_profile}' - ), - projectLocationSecurityProfileGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}' + 'projects/{project}', ), + projectLocationFirewallEndpointsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/firewallEndpoints/{firewall_endpoint}', + ), + projectLocationSecurityProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfiles/{security_profile}', + ), + projectLocationSecurityProfileGroupPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securityProfileGroups/{security_profile_group}', + ), sACAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}' + 'projects/{project}/locations/{location}/sacAttachments/{sac_attachment}', ), sACRealmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sacRealms/{sac_realm}' + 'projects/{project}/locations/{location}/sacRealms/{sac_realm}', ), sSEGatewayReferencePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}' + 'projects/{project}/locations/{location}/sseGatewayReferences/{sse_gateway_reference}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), tlsInspectionPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}' + 'projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}', ), urlListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/urlLists/{url_list}' + 'projects/{project}/locations/{location}/urlLists/{url_list}', ), }; @@ -289,12 +327,21 @@ export class SSERealmServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listSACRealms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sacRealms'), - listSACAttachments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sacAttachments'), - listPartnerSSERealms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'partnerSseRealms') + listSACRealms: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sacRealms', + ), + listSACAttachments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sacAttachments', + ), + listPartnerSSERealms: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'partnerSseRealms', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -303,76 +350,210 @@ export class SSERealmServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy',},{get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions',body: '*',},{post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',additional_bindings: [{post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1alpha1/{name=organizations/*/locations/*}/operations',}], - }]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:getIamPolicy', + }, + { + get: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/addressGroups/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1alpha1/{resource=projects/*/locations/*/authzPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + delete: + '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v1alpha1/{name=organizations/*/locations/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + { get: '/v1alpha1/{name=organizations/*/locations/*}/operations' }, + ], + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createSACRealmResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SACRealm') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SACRealm', + ) as gax.protobuf.Type; const createSACRealmMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSACRealmResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSACRealmMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createSACAttachmentResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.SACAttachment') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.SACAttachment', + ) as gax.protobuf.Type; const createSACAttachmentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSACAttachmentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSACAttachmentMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const createPartnerSSERealmResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.PartnerSSERealm') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.PartnerSSERealm', + ) as gax.protobuf.Type; const createPartnerSSERealmMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; const deletePartnerSSERealmResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deletePartnerSSERealmMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1alpha1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createSACRealm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createSACRealmResponse.decode.bind(createSACRealmResponse), - createSACRealmMetadata.decode.bind(createSACRealmMetadata)), + createSACRealmMetadata.decode.bind(createSACRealmMetadata), + ), deleteSACRealm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteSACRealmResponse.decode.bind(deleteSACRealmResponse), - deleteSACRealmMetadata.decode.bind(deleteSACRealmMetadata)), + deleteSACRealmMetadata.decode.bind(deleteSACRealmMetadata), + ), createSACAttachment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createSACAttachmentResponse.decode.bind(createSACAttachmentResponse), - createSACAttachmentMetadata.decode.bind(createSACAttachmentMetadata)), + createSACAttachmentMetadata.decode.bind(createSACAttachmentMetadata), + ), deleteSACAttachment: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteSACAttachmentResponse.decode.bind(deleteSACAttachmentResponse), - deleteSACAttachmentMetadata.decode.bind(deleteSACAttachmentMetadata)), + deleteSACAttachmentMetadata.decode.bind(deleteSACAttachmentMetadata), + ), createPartnerSSERealm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createPartnerSSERealmResponse.decode.bind(createPartnerSSERealmResponse), - createPartnerSSERealmMetadata.decode.bind(createPartnerSSERealmMetadata)), + createPartnerSSERealmResponse.decode.bind( + createPartnerSSERealmResponse, + ), + createPartnerSSERealmMetadata.decode.bind( + createPartnerSSERealmMetadata, + ), + ), deletePartnerSSERealm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deletePartnerSSERealmResponse.decode.bind(deletePartnerSSERealmResponse), - deletePartnerSSERealmMetadata.decode.bind(deletePartnerSSERealmMetadata)) + deletePartnerSSERealmResponse.decode.bind( + deletePartnerSSERealmResponse, + ), + deletePartnerSSERealmMetadata.decode.bind( + deletePartnerSSERealmMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1alpha1.SSERealmService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1alpha1.SSERealmService', + 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 @@ -403,28 +584,47 @@ export class SSERealmServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1alpha1.SSERealmService. this.sSERealmServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1alpha1.SSERealmService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1alpha1.SSERealmService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1alpha1.SSERealmService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1alpha1 + .SSERealmService, + 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 sSERealmServiceStubMethods = - ['listSacRealms', 'getSacRealm', 'createSacRealm', 'deleteSacRealm', 'listSacAttachments', 'getSacAttachment', 'createSacAttachment', 'deleteSacAttachment', 'listPartnerSseRealms', 'getPartnerSseRealm', 'createPartnerSseRealm', 'deletePartnerSseRealm']; + const sSERealmServiceStubMethods = [ + 'listSacRealms', + 'getSacRealm', + 'createSacRealm', + 'deleteSacRealm', + 'listSacAttachments', + 'getSacAttachment', + 'createSacAttachment', + 'deleteSacAttachment', + 'listPartnerSseRealms', + 'getPartnerSseRealm', + 'createPartnerSseRealm', + 'deletePartnerSseRealm', + ]; for (const methodName of sSERealmServiceStubMethods) { const callPromise = this.sSERealmServiceStub.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) => () => { + (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] || @@ -434,7 +634,7 @@ export class SSERealmServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -449,8 +649,14 @@ export class SSERealmServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -461,8 +667,14 @@ export class SSERealmServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -493,9 +705,7 @@ export class SSERealmServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -504,8 +714,9 @@ export class SSERealmServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -516,1134 +727,1678 @@ export class SSERealmServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Returns the specified realm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource, in the form - * `projects/{project}/locations/global/sacRealms/{sacRealm}`. - * @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.networksecurity.v1alpha1.SACRealm|SACRealm}. - * 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/v1alpha1/s_s_e_realm_service.get_s_a_c_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetSACRealm_async - */ + /** + * Returns the specified realm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + * @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.networksecurity.v1alpha1.SACRealm|SACRealm}. + * 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/v1alpha1/s_s_e_realm_service.get_s_a_c_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetSACRealm_async + */ getSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | undefined + ), + {} | undefined, + ] + >; getSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSACRealm request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSACRealm response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSacRealm(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm, - protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSACRealm response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSacRealm(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACRealmRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSACRealm response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Returns the specified attachment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource, in the form - * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. - * @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.networksecurity.v1alpha1.SACAttachment|SACAttachment}. - * 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/v1alpha1/s_s_e_realm_service.get_s_a_c_attachment.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetSACAttachment_async - */ + /** + * Returns the specified attachment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + * @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.networksecurity.v1alpha1.SACAttachment|SACAttachment}. + * 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/v1alpha1/s_s_e_realm_service.get_s_a_c_attachment.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetSACAttachment_async + */ getSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | undefined + ), + {} | undefined, + ] + >; getSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSACAttachment request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSACAttachment response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSacAttachment(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, - protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSACAttachment response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetSACAttachmentRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSACAttachment response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single PartnerSSERealm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. - * 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/v1alpha1/s_s_e_realm_service.get_partner_s_s_e_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetPartnerSSERealm_async - */ + /** + * Gets details of a single PartnerSSERealm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the 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 {@link protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. + * 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/v1alpha1/s_s_e_realm_service.get_partner_s_s_e_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_GetPartnerSSERealm_async + */ getPartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | undefined + ), + {} | undefined, + ] + >; getPartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getPartnerSSERealm request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getPartnerSSERealm response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getPartnerSseRealm(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, - protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest|undefined, - {}|undefined - ]) => { - this._log.info('getPartnerSSERealm response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getPartnerSseRealm(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + ( + | protos.google.cloud.networksecurity.v1alpha1.IGetPartnerSSERealmRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getPartnerSSERealm response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new SACRealm in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form `projects/{project}/locations/global`. - * @param {string} request.sacRealmId - * Required. ID of the created realm. - * The ID must be 1-63 characters long, and comply with - * RFC1035. - * Specifically, it must be 1-63 characters long and match the regular - * expression `[a-z]([-a-z0-9]*[a-z0-9])?` - * which means the first character must be a lowercase letter, and all - * following characters must be a dash, lowercase letter, or digit, except - * the last character, which cannot be a dash. - * @param {google.cloud.networksecurity.v1alpha1.SACRealm} request.sacRealm - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.create_s_a_c_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACRealm_async - */ + /** + * Creates a new SACRealm in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {string} request.sacRealmId + * Required. ID of the created realm. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + * @param {google.cloud.networksecurity.v1alpha1.SACRealm} request.sacRealm + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.create_s_a_c_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACRealm_async + */ createSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSACRealm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSACRealm request %j', request); - return this.innerApiCalls.createSacRealm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSACRealm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSacRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSACRealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSACRealm()`. - * @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/v1alpha1/s_s_e_realm_service.create_s_a_c_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACRealm_async - */ - async checkCreateSACRealmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSACRealm()`. + * @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/v1alpha1/s_s_e_realm_service.create_s_a_c_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACRealm_async + */ + async checkCreateSACRealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SACRealm, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createSACRealm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSACRealm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSACRealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SACRealm, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes the specified realm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource, in the form - * `projects/{project}/locations/global/sacRealms/{sacRealm}`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_s_a_c_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACRealm_async - */ + /** + * Deletes the specified realm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/global/sacRealms/{sacRealm}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_s_a_c_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACRealm_async + */ deleteSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSACRealm( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSACRealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACRealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSACRealm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSACRealm request %j', request); - return this.innerApiCalls.deleteSacRealm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSACRealm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSacRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSACRealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSACRealm()`. - * @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/v1alpha1/s_s_e_realm_service.delete_s_a_c_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACRealm_async - */ - async checkDeleteSACRealmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSACRealm()`. + * @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/v1alpha1/s_s_e_realm_service.delete_s_a_c_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACRealm_async + */ + async checkDeleteSACRealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteSACRealm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSACRealm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSACRealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new SACAttachment in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form - * `projects/{project}/locations/{location}`. - * @param {string} request.sacAttachmentId - * Required. ID of the created attachment. - * The ID must be 1-63 characters long, and comply with - * RFC1035. - * Specifically, it must be 1-63 characters long and match the regular - * expression `[a-z]([-a-z0-9]*[a-z0-9])?` - * which means the first character must be a lowercase letter, and all - * following characters must be a dash, lowercase letter, or digit, except - * the last character, which cannot be a dash. - * @param {google.cloud.networksecurity.v1alpha1.SACAttachment} request.sacAttachment - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.create_s_a_c_attachment.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACAttachment_async - */ + /** + * Creates a new SACAttachment in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {string} request.sacAttachmentId + * Required. ID of the created attachment. + * The ID must be 1-63 characters long, and comply with + * RFC1035. + * Specifically, it must be 1-63 characters long and match the regular + * expression `[a-z]([-a-z0-9]*[a-z0-9])?` + * which means the first character must be a lowercase letter, and all + * following characters must be a dash, lowercase letter, or digit, except + * the last character, which cannot be a dash. + * @param {google.cloud.networksecurity.v1alpha1.SACAttachment} request.sacAttachment + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.create_s_a_c_attachment.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACAttachment_async + */ createSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreateSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSACAttachment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSACAttachment request %j', request); - return this.innerApiCalls.createSacAttachment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSACAttachment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSACAttachment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSACAttachment()`. - * @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/v1alpha1/s_s_e_realm_service.create_s_a_c_attachment.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACAttachment_async - */ - async checkCreateSACAttachmentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSACAttachment()`. + * @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/v1alpha1/s_s_e_realm_service.create_s_a_c_attachment.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreateSACAttachment_async + */ + async checkCreateSACAttachmentProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.SACAttachment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createSACAttachment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createSACAttachment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSACAttachment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.SACAttachment, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes the specified attachment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource, in the form - * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_s_a_c_attachment.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACAttachment_async - */ + /** + * Deletes the specified attachment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource, in the form + * `projects/{project}/locations/{location}/sacAttachments/{sac_attachment}`. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_s_a_c_attachment.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACAttachment_async + */ deleteSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSACAttachment( - request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSACAttachment( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeleteSACAttachmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSACAttachment response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSACAttachment request %j', request); - return this.innerApiCalls.deleteSacAttachment(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSACAttachment response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSacAttachment(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSACAttachment response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSACAttachment()`. - * @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/v1alpha1/s_s_e_realm_service.delete_s_a_c_attachment.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACAttachment_async - */ - async checkDeleteSACAttachmentProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSACAttachment()`. + * @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/v1alpha1/s_s_e_realm_service.delete_s_a_c_attachment.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeleteSACAttachment_async + */ + async checkDeleteSACAttachmentProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deleteSACAttachment long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteSACAttachment, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSACAttachment, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Creates a new PartnerSSERealm in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.partnerSseRealmId - * Required. Id of the requesting object - * If auto-generating Id server-side, remove this field and - * partner_sse_realm_id from the method_signature of Create RPC - * @param {google.cloud.networksecurity.v1alpha1.PartnerSSERealm} request.partnerSseRealm - * Required. The resource being created - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.create_partner_s_s_e_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreatePartnerSSERealm_async - */ + /** + * Creates a new PartnerSSERealm in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.partnerSseRealmId + * Required. Id of the requesting object + * If auto-generating Id server-side, remove this field and + * partner_sse_realm_id from the method_signature of Create RPC + * @param {google.cloud.networksecurity.v1alpha1.PartnerSSERealm} request.partnerSseRealm + * Required. The resource being created + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.create_partner_s_s_e_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreatePartnerSSERealm_async + */ createPartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createPartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.ICreatePartnerSSERealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createPartnerSSERealm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createPartnerSSERealm request %j', request); - return this.innerApiCalls.createPartnerSseRealm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createPartnerSSERealm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createPartnerSseRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createPartnerSSERealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createPartnerSSERealm()`. - * @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/v1alpha1/s_s_e_realm_service.create_partner_s_s_e_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreatePartnerSSERealm_async - */ - async checkCreatePartnerSSERealmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createPartnerSSERealm()`. + * @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/v1alpha1/s_s_e_realm_service.create_partner_s_s_e_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_CreatePartnerSSERealm_async + */ + async checkCreatePartnerSSERealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('createPartnerSSERealm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createPartnerSSERealm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createPartnerSSERealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; } -/** - * Deletes a single PartnerSSERealm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_partner_s_s_e_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeletePartnerSSERealm_async - */ + /** + * Deletes a single PartnerSSERealm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@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/v1alpha1/s_s_e_realm_service.delete_partner_s_s_e_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeletePartnerSSERealm_async + */ deletePartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deletePartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePartnerSSERealm( - request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePartnerSSERealm( - request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1alpha1.IDeletePartnerSSERealmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deletePartnerSSERealm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deletePartnerSSERealm request %j', request); - return this.innerApiCalls.deletePartnerSseRealm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deletePartnerSSERealm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deletePartnerSseRealm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deletePartnerSSERealm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deletePartnerSSERealm()`. - * @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/v1alpha1/s_s_e_realm_service.delete_partner_s_s_e_realm.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeletePartnerSSERealm_async - */ - async checkDeletePartnerSSERealmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deletePartnerSSERealm()`. + * @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/v1alpha1/s_s_e_realm_service.delete_partner_s_s_e_realm.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_DeletePartnerSSERealm_async + */ + async checkDeletePartnerSSERealmProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + > + > { this._log.info('deletePartnerSSERealm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deletePartnerSSERealm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists SACRealms in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form `projects/{project}/locations/global`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1alpha1.SACRealm|SACRealm}. - * 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 `listSACRealmsAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deletePartnerSSERealm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1alpha1.OperationMetadata + >; + } + /** + * Lists SACRealms in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1alpha1.SACRealm|SACRealm}. + * 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 `listSACRealmsAsync()` + * 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. + */ listSACRealms( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse, + ] + >; listSACRealms( - request: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACRealm>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACRealm + >, + ): void; listSACRealms( - request: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACRealm>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACRealm + >, + ): void; listSACRealms( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACRealm>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACRealm>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACRealm + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACRealm + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACRealm>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACRealm + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSACRealms values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1652,205 +2407,234 @@ export class SSERealmServiceClient { this._log.info('listSACRealms request %j', request); return this.innerApiCalls .listSacRealms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse - ]) => { - this._log.info('listSACRealms values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ISACRealm[], + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsResponse, + ]) => { + this._log.info('listSACRealms values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSACRealms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form `projects/{project}/locations/global`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1alpha1.SACRealm|SACRealm} 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 `listSACRealmsAsync()` - * 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. - */ + /** + * Equivalent to `listSACRealms`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1alpha1.SACRealm|SACRealm} 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 `listSACRealmsAsync()` + * 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. + */ listSACRealmsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSacRealms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSACRealms stream %j', request); return this.descriptors.page.listSACRealms.createStream( this.innerApiCalls.listSacRealms as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSACRealms`, 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, in the form `projects/{project}/locations/global`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@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.networksecurity.v1alpha1.SACRealm|SACRealm}. 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/v1alpha1/s_s_e_realm_service.list_s_a_c_realms.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListSACRealms_async - */ + /** + * Equivalent to `listSACRealms`, 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, in the form `projects/{project}/locations/global`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@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.networksecurity.v1alpha1.SACRealm|SACRealm}. 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/v1alpha1/s_s_e_realm_service.list_s_a_c_realms.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListSACRealms_async + */ listSACRealmsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACRealmsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSacRealms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSACRealms iterate %j', request); return this.descriptors.page.listSACRealms.asyncIterate( this.innerApiCalls['listSacRealms'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists SACAttachments in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1alpha1.SACAttachment|SACAttachment}. - * 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 `listSACAttachmentsAsync()` - * 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. - */ + /** + * Lists SACAttachments in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.networksecurity.v1alpha1.SACAttachment|SACAttachment}. + * 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 `listSACAttachmentsAsync()` + * 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. + */ listSACAttachments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse, + ] + >; listSACAttachments( - request: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment + >, + ): void; listSACAttachments( - request: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment + >, + ): void; listSACAttachments( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSACAttachments values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1859,206 +2643,235 @@ export class SSERealmServiceClient { this._log.info('listSACAttachments request %j', request); return this.innerApiCalls .listSacAttachments(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse - ]) => { - this._log.info('listSACAttachments values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[], + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsResponse, + ]) => { + this._log.info('listSACAttachments values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSACAttachments`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, in the form - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1alpha1.SACAttachment|SACAttachment} 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 `listSACAttachmentsAsync()` - * 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. - */ + /** + * Equivalent to `listSACAttachments`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.networksecurity.v1alpha1.SACAttachment|SACAttachment} 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 `listSACAttachmentsAsync()` + * 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. + */ listSACAttachmentsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSacAttachments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSACAttachments stream %j', request); return this.descriptors.page.listSACAttachments.createStream( this.innerApiCalls.listSacAttachments as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSACAttachments`, 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, in the form - * `projects/{project}/locations/{location}`. - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. If unspecified, server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. An expression that filters the list of results. - * @param {string} [request.orderBy] - * Optional. Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@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.networksecurity.v1alpha1.SACAttachment|SACAttachment}. 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/v1alpha1/s_s_e_realm_service.list_s_a_c_attachments.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListSACAttachments_async - */ + /** + * Equivalent to `listSACAttachments`, 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, in the form + * `projects/{project}/locations/{location}`. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the list of results. + * @param {string} [request.orderBy] + * Optional. Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@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.networksecurity.v1alpha1.SACAttachment|SACAttachment}. 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/v1alpha1/s_s_e_realm_service.list_s_a_c_attachments.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListSACAttachments_async + */ listSACAttachmentsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListSACAttachmentsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSacAttachments']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSACAttachments iterate %j', request); return this.descriptors.page.listSACAttachments.asyncIterate( this.innerApiCalls['listSacAttachments'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists PartnerSSERealms in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPartnerSSERealmsRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. - * 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 `listPartnerSSERealmsAsync()` - * 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. - */ + /** + * Lists PartnerSSERealms in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPartnerSSERealmsRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. + * 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 `listPartnerSSERealmsAsync()` + * 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. + */ listPartnerSSERealms( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse, + ] + >; listPartnerSSERealms( - request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm + >, + ): void; listPartnerSSERealms( - request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm>): void; + request: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm + >, + ): void; listPartnerSSERealms( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm>): - Promise<[ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse|null|undefined, - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + | protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPartnerSSERealms values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2067,143 +2880,147 @@ export class SSERealmServiceClient { this._log.info('listPartnerSSERealms request %j', request); return this.innerApiCalls .listPartnerSseRealms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest|null, - protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse - ]) => { - this._log.info('listPartnerSSERealms values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[], + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest | null, + protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsResponse, + ]) => { + this._log.info('listPartnerSSERealms values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPartnerSSERealms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPartnerSSERealmsRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm} 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 `listPartnerSSERealmsAsync()` - * 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. - */ + /** + * Equivalent to `listPartnerSSERealms`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPartnerSSERealmsRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm} 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 `listPartnerSSERealmsAsync()` + * 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. + */ listPartnerSSERealmsStream( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPartnerSseRealms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPartnerSSERealms stream %j', request); return this.descriptors.page.listPartnerSSERealms.createStream( this.innerApiCalls.listPartnerSseRealms as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPartnerSSERealms`, 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. Parent value for ListPartnerSSERealmsRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. 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/v1alpha1/s_s_e_realm_service.list_partner_s_s_e_realms.js - * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListPartnerSSERealms_async - */ + /** + * Equivalent to `listPartnerSSERealms`, 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. Parent value for ListPartnerSSERealmsRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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.networksecurity.v1alpha1.PartnerSSERealm|PartnerSSERealm}. 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/v1alpha1/s_s_e_realm_service.list_partner_s_s_e_realms.js + * region_tag:networksecurity_v1alpha1_generated_SSERealmService_ListPartnerSSERealms_async + */ listPartnerSSERealmsAsync( - request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1alpha1.IListPartnerSSERealmsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPartnerSseRealms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPartnerSSERealms iterate %j', request); return this.descriptors.page.listPartnerSSERealms.asyncIterate( this.innerApiCalls['listPartnerSseRealms'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -2217,40 +3034,40 @@ export class SSERealmServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -2264,41 +3081,41 @@ export class SSERealmServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -2312,12 +3129,12 @@ export class SSERealmServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -2352,12 +3169,11 @@ export class SSERealmServiceClient { | 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. @@ -2390,12 +3206,12 @@ export class SSERealmServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2438,22 +3254,22 @@ export class SSERealmServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2488,15 +3304,15 @@ export class SSERealmServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2530,7 +3346,7 @@ export class SSERealmServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2543,25 +3359,24 @@ export class SSERealmServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2600,22 +3415,22 @@ export class SSERealmServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2631,7 +3446,11 @@ export class SSERealmServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2647,7 +3466,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2658,7 +3479,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2668,8 +3491,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2680,7 +3507,7 @@ export class SSERealmServiceClient { * @param {string} authz_policy * @returns {string} Resource name string. */ - authzPolicyPath(project:string,location:string,authzPolicy:string) { + authzPolicyPath(project: string, location: string, authzPolicy: string) { return this.pathTemplates.authzPolicyPathTemplate.render({ project: project, location: location, @@ -2696,7 +3523,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).project; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .project; } /** @@ -2707,7 +3535,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).location; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .location; } /** @@ -2718,7 +3547,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the authz_policy. */ matchAuthzPolicyFromAuthzPolicyName(authzPolicyName: string) { - return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName).authz_policy; + return this.pathTemplates.authzPolicyPathTemplate.match(authzPolicyName) + .authz_policy; } /** @@ -2729,7 +3559,11 @@ export class SSERealmServiceClient { * @param {string} backend_authentication_config * @returns {string} Resource name string. */ - backendAuthenticationConfigPath(project:string,location:string,backendAuthenticationConfig:string) { + backendAuthenticationConfigPath( + project: string, + location: string, + backendAuthenticationConfig: string, + ) { return this.pathTemplates.backendAuthenticationConfigPathTemplate.render({ project: project, location: location, @@ -2744,8 +3578,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the project. */ - matchProjectFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).project; + matchProjectFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).project; } /** @@ -2755,8 +3593,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the location. */ - matchLocationFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).location; + matchLocationFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).location; } /** @@ -2766,8 +3608,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing BackendAuthenticationConfig resource. * @returns {string} A string representing the backend_authentication_config. */ - matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(backendAuthenticationConfigName: string) { - return this.pathTemplates.backendAuthenticationConfigPathTemplate.match(backendAuthenticationConfigName).backend_authentication_config; + matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + backendAuthenticationConfigName: string, + ) { + return this.pathTemplates.backendAuthenticationConfigPathTemplate.match( + backendAuthenticationConfigName, + ).backend_authentication_config; } /** @@ -2778,7 +3624,11 @@ export class SSERealmServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2794,7 +3644,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2805,7 +3657,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2816,7 +3670,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2827,7 +3683,11 @@ export class SSERealmServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2843,7 +3703,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2854,7 +3716,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2864,8 +3728,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2876,7 +3744,11 @@ export class SSERealmServiceClient { * @param {string} firewall_endpoint_association * @returns {string} Resource name string. */ - firewallEndpointAssociationPath(project:string,location:string,firewallEndpointAssociation:string) { + firewallEndpointAssociationPath( + project: string, + location: string, + firewallEndpointAssociation: string, + ) { return this.pathTemplates.firewallEndpointAssociationPathTemplate.render({ project: project, location: location, @@ -2891,8 +3763,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).project; + matchProjectFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).project; } /** @@ -2902,8 +3778,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).location; + matchLocationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).location; } /** @@ -2913,8 +3793,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing FirewallEndpointAssociation resource. * @returns {string} A string representing the firewall_endpoint_association. */ - matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(firewallEndpointAssociationName: string) { - return this.pathTemplates.firewallEndpointAssociationPathTemplate.match(firewallEndpointAssociationName).firewall_endpoint_association; + matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + firewallEndpointAssociationName: string, + ) { + return this.pathTemplates.firewallEndpointAssociationPathTemplate.match( + firewallEndpointAssociationName, + ).firewall_endpoint_association; } /** @@ -2925,7 +3809,11 @@ export class SSERealmServiceClient { * @param {string} gateway_security_policy * @returns {string} Resource name string. */ - gatewaySecurityPolicyPath(project:string,location:string,gatewaySecurityPolicy:string) { + gatewaySecurityPolicyPath( + project: string, + location: string, + gatewaySecurityPolicy: string, + ) { return this.pathTemplates.gatewaySecurityPolicyPathTemplate.render({ project: project, location: location, @@ -2941,7 +3829,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).project; + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).project; } /** @@ -2951,8 +3841,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).location; + matchLocationFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).location; } /** @@ -2962,8 +3856,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicy resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(gatewaySecurityPolicyName: string) { - return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match(gatewaySecurityPolicyName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + gatewaySecurityPolicyName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyPathTemplate.match( + gatewaySecurityPolicyName, + ).gateway_security_policy; } /** @@ -2975,7 +3873,12 @@ export class SSERealmServiceClient { * @param {string} rule * @returns {string} Resource name string. */ - gatewaySecurityPolicyRulePath(project:string,location:string,gatewaySecurityPolicy:string,rule:string) { + gatewaySecurityPolicyRulePath( + project: string, + location: string, + gatewaySecurityPolicy: string, + rule: string, + ) { return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render({ project: project, location: location, @@ -2991,8 +3894,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the project. */ - matchProjectFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).project; + matchProjectFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).project; } /** @@ -3002,8 +3909,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the location. */ - matchLocationFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).location; + matchLocationFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).location; } /** @@ -3013,8 +3924,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the gateway_security_policy. */ - matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).gateway_security_policy; + matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).gateway_security_policy; } /** @@ -3024,8 +3939,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing GatewaySecurityPolicyRule resource. * @returns {string} A string representing the rule. */ - matchRuleFromGatewaySecurityPolicyRuleName(gatewaySecurityPolicyRuleName: string) { - return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match(gatewaySecurityPolicyRuleName).rule; + matchRuleFromGatewaySecurityPolicyRuleName( + gatewaySecurityPolicyRuleName: string, + ) { + return this.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match( + gatewaySecurityPolicyRuleName, + ).rule; } /** @@ -3036,7 +3955,11 @@ export class SSERealmServiceClient { * @param {string} intercept_deployment * @returns {string} Resource name string. */ - interceptDeploymentPath(project:string,location:string,interceptDeployment:string) { + interceptDeploymentPath( + project: string, + location: string, + interceptDeployment: string, + ) { return this.pathTemplates.interceptDeploymentPathTemplate.render({ project: project, location: location, @@ -3052,7 +3975,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).project; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).project; } /** @@ -3063,7 +3988,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).location; + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).location; } /** @@ -3073,8 +4000,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptDeployment resource. * @returns {string} A string representing the intercept_deployment. */ - matchInterceptDeploymentFromInterceptDeploymentName(interceptDeploymentName: string) { - return this.pathTemplates.interceptDeploymentPathTemplate.match(interceptDeploymentName).intercept_deployment; + matchInterceptDeploymentFromInterceptDeploymentName( + interceptDeploymentName: string, + ) { + return this.pathTemplates.interceptDeploymentPathTemplate.match( + interceptDeploymentName, + ).intercept_deployment; } /** @@ -3085,7 +4016,11 @@ export class SSERealmServiceClient { * @param {string} intercept_deployment_group * @returns {string} Resource name string. */ - interceptDeploymentGroupPath(project:string,location:string,interceptDeploymentGroup:string) { + interceptDeploymentGroupPath( + project: string, + location: string, + interceptDeploymentGroup: string, + ) { return this.pathTemplates.interceptDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -3100,8 +4035,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).project; + matchProjectFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).project; } /** @@ -3111,8 +4050,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).location; + matchLocationFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).location; } /** @@ -3122,8 +4065,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptDeploymentGroup resource. * @returns {string} A string representing the intercept_deployment_group. */ - matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(interceptDeploymentGroupName: string) { - return this.pathTemplates.interceptDeploymentGroupPathTemplate.match(interceptDeploymentGroupName).intercept_deployment_group; + matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + interceptDeploymentGroupName: string, + ) { + return this.pathTemplates.interceptDeploymentGroupPathTemplate.match( + interceptDeploymentGroupName, + ).intercept_deployment_group; } /** @@ -3134,7 +4081,11 @@ export class SSERealmServiceClient { * @param {string} intercept_endpoint_group * @returns {string} Resource name string. */ - interceptEndpointGroupPath(project:string,location:string,interceptEndpointGroup:string) { + interceptEndpointGroupPath( + project: string, + location: string, + interceptEndpointGroup: string, + ) { return this.pathTemplates.interceptEndpointGroupPathTemplate.render({ project: project, location: location, @@ -3149,8 +4100,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).project; + matchProjectFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).project; } /** @@ -3160,8 +4115,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).location; + matchLocationFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).location; } /** @@ -3171,8 +4130,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroup resource. * @returns {string} A string representing the intercept_endpoint_group. */ - matchInterceptEndpointGroupFromInterceptEndpointGroupName(interceptEndpointGroupName: string) { - return this.pathTemplates.interceptEndpointGroupPathTemplate.match(interceptEndpointGroupName).intercept_endpoint_group; + matchInterceptEndpointGroupFromInterceptEndpointGroupName( + interceptEndpointGroupName: string, + ) { + return this.pathTemplates.interceptEndpointGroupPathTemplate.match( + interceptEndpointGroupName, + ).intercept_endpoint_group; } /** @@ -3183,12 +4146,18 @@ export class SSERealmServiceClient { * @param {string} intercept_endpoint_group_association * @returns {string} Resource name string. */ - interceptEndpointGroupAssociationPath(project:string,location:string,interceptEndpointGroupAssociation:string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - intercept_endpoint_group_association: interceptEndpointGroupAssociation, - }); + interceptEndpointGroupAssociationPath( + project: string, + location: string, + interceptEndpointGroupAssociation: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + intercept_endpoint_group_association: interceptEndpointGroupAssociation, + }, + ); } /** @@ -3198,8 +4167,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).project; + matchProjectFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).project; } /** @@ -3209,8 +4182,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).location; + matchLocationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).location; } /** @@ -3220,8 +4197,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing InterceptEndpointGroupAssociation resource. * @returns {string} A string representing the intercept_endpoint_group_association. */ - matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(interceptEndpointGroupAssociationName: string) { - return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match(interceptEndpointGroupAssociationName).intercept_endpoint_group_association; + matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + interceptEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match( + interceptEndpointGroupAssociationName, + ).intercept_endpoint_group_association; } /** @@ -3231,7 +4212,7 @@ export class SSERealmServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -3268,7 +4249,11 @@ export class SSERealmServiceClient { * @param {string} mirroring_deployment * @returns {string} Resource name string. */ - mirroringDeploymentPath(project:string,location:string,mirroringDeployment:string) { + mirroringDeploymentPath( + project: string, + location: string, + mirroringDeployment: string, + ) { return this.pathTemplates.mirroringDeploymentPathTemplate.render({ project: project, location: location, @@ -3284,7 +4269,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).project; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).project; } /** @@ -3295,7 +4282,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).location; + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).location; } /** @@ -3305,8 +4294,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringDeployment resource. * @returns {string} A string representing the mirroring_deployment. */ - matchMirroringDeploymentFromMirroringDeploymentName(mirroringDeploymentName: string) { - return this.pathTemplates.mirroringDeploymentPathTemplate.match(mirroringDeploymentName).mirroring_deployment; + matchMirroringDeploymentFromMirroringDeploymentName( + mirroringDeploymentName: string, + ) { + return this.pathTemplates.mirroringDeploymentPathTemplate.match( + mirroringDeploymentName, + ).mirroring_deployment; } /** @@ -3317,7 +4310,11 @@ export class SSERealmServiceClient { * @param {string} mirroring_deployment_group * @returns {string} Resource name string. */ - mirroringDeploymentGroupPath(project:string,location:string,mirroringDeploymentGroup:string) { + mirroringDeploymentGroupPath( + project: string, + location: string, + mirroringDeploymentGroup: string, + ) { return this.pathTemplates.mirroringDeploymentGroupPathTemplate.render({ project: project, location: location, @@ -3332,8 +4329,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).project; + matchProjectFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).project; } /** @@ -3343,8 +4344,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).location; + matchLocationFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).location; } /** @@ -3354,8 +4359,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringDeploymentGroup resource. * @returns {string} A string representing the mirroring_deployment_group. */ - matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(mirroringDeploymentGroupName: string) { - return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match(mirroringDeploymentGroupName).mirroring_deployment_group; + matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + mirroringDeploymentGroupName: string, + ) { + return this.pathTemplates.mirroringDeploymentGroupPathTemplate.match( + mirroringDeploymentGroupName, + ).mirroring_deployment_group; } /** @@ -3366,7 +4375,11 @@ export class SSERealmServiceClient { * @param {string} mirroring_endpoint_group * @returns {string} Resource name string. */ - mirroringEndpointGroupPath(project:string,location:string,mirroringEndpointGroup:string) { + mirroringEndpointGroupPath( + project: string, + location: string, + mirroringEndpointGroup: string, + ) { return this.pathTemplates.mirroringEndpointGroupPathTemplate.render({ project: project, location: location, @@ -3381,8 +4394,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).project; + matchProjectFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).project; } /** @@ -3392,8 +4409,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).location; + matchLocationFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).location; } /** @@ -3403,8 +4424,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroup resource. * @returns {string} A string representing the mirroring_endpoint_group. */ - matchMirroringEndpointGroupFromMirroringEndpointGroupName(mirroringEndpointGroupName: string) { - return this.pathTemplates.mirroringEndpointGroupPathTemplate.match(mirroringEndpointGroupName).mirroring_endpoint_group; + matchMirroringEndpointGroupFromMirroringEndpointGroupName( + mirroringEndpointGroupName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupPathTemplate.match( + mirroringEndpointGroupName, + ).mirroring_endpoint_group; } /** @@ -3415,12 +4440,18 @@ export class SSERealmServiceClient { * @param {string} mirroring_endpoint_group_association * @returns {string} Resource name string. */ - mirroringEndpointGroupAssociationPath(project:string,location:string,mirroringEndpointGroupAssociation:string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render({ - project: project, - location: location, - mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, - }); + mirroringEndpointGroupAssociationPath( + project: string, + location: string, + mirroringEndpointGroupAssociation: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render( + { + project: project, + location: location, + mirroring_endpoint_group_association: mirroringEndpointGroupAssociation, + }, + ); } /** @@ -3430,8 +4461,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the project. */ - matchProjectFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).project; + matchProjectFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).project; } /** @@ -3441,8 +4476,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the location. */ - matchLocationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).location; + matchLocationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).location; } /** @@ -3452,8 +4491,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing MirroringEndpointGroupAssociation resource. * @returns {string} A string representing the mirroring_endpoint_group_association. */ - matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(mirroringEndpointGroupAssociationName: string) { - return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match(mirroringEndpointGroupAssociationName).mirroring_endpoint_group_association; + matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + mirroringEndpointGroupAssociationName: string, + ) { + return this.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match( + mirroringEndpointGroupAssociationName, + ).mirroring_endpoint_group_association; } /** @@ -3464,12 +4507,18 @@ export class SSERealmServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - organizationLocationFirewallEndpointsPath(organization:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render({ - organization: organization, - location: location, - firewall_endpoint: firewallEndpoint, - }); + organizationLocationFirewallEndpointsPath( + organization: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render( + { + organization: organization, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3479,8 +4528,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).organization; + matchOrganizationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).organization; } /** @@ -3490,8 +4543,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).location; + matchLocationFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).location; } /** @@ -3501,8 +4558,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(organizationLocationFirewallEndpointsName: string) { - return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match(organizationLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + organizationLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match( + organizationLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3513,12 +4574,18 @@ export class SSERealmServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - organizationLocationSecurityProfilePath(organization:string,location:string,securityProfile:string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render({ - organization: organization, - location: location, - security_profile: securityProfile, - }); + organizationLocationSecurityProfilePath( + organization: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.render( + { + organization: organization, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3528,8 +4595,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).organization; } /** @@ -3539,8 +4610,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).location; + matchLocationFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).location; } /** @@ -3550,8 +4625,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromOrganizationLocationSecurityProfileName(organizationLocationSecurityProfileName: string) { - return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match(organizationLocationSecurityProfileName).security_profile; + matchSecurityProfileFromOrganizationLocationSecurityProfileName( + organizationLocationSecurityProfileName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfilePathTemplate.match( + organizationLocationSecurityProfileName, + ).security_profile; } /** @@ -3562,12 +4641,18 @@ export class SSERealmServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - organizationLocationSecurityProfileGroupPath(organization:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render({ - organization: organization, - location: location, - security_profile_group: securityProfileGroup, - }); + organizationLocationSecurityProfileGroupPath( + organization: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render( + { + organization: organization, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3577,8 +4662,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).organization; + matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).organization; } /** @@ -3588,8 +4677,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).location; + matchLocationFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).location; } /** @@ -3599,8 +4692,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing organization_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(organizationLocationSecurityProfileGroupName: string) { - return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match(organizationLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + organizationLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match( + organizationLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3611,7 +4708,11 @@ export class SSERealmServiceClient { * @param {string} partner_sse_gateway * @returns {string} Resource name string. */ - partnerSSEGatewayPath(project:string,location:string,partnerSseGateway:string) { + partnerSSEGatewayPath( + project: string, + location: string, + partnerSseGateway: string, + ) { return this.pathTemplates.partnerSSEGatewayPathTemplate.render({ project: project, location: location, @@ -3627,7 +4728,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).project; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).project; } /** @@ -3638,7 +4741,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).location; + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).location; } /** @@ -3648,8 +4753,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing PartnerSSEGateway resource. * @returns {string} A string representing the partner_sse_gateway. */ - matchPartnerSseGatewayFromPartnerSSEGatewayName(partnerSSEGatewayName: string) { - return this.pathTemplates.partnerSSEGatewayPathTemplate.match(partnerSSEGatewayName).partner_sse_gateway; + matchPartnerSseGatewayFromPartnerSSEGatewayName( + partnerSSEGatewayName: string, + ) { + return this.pathTemplates.partnerSSEGatewayPathTemplate.match( + partnerSSEGatewayName, + ).partner_sse_gateway; } /** @@ -3660,7 +4769,11 @@ export class SSERealmServiceClient { * @param {string} partner_sse_realm * @returns {string} Resource name string. */ - partnerSSERealmPath(project:string,location:string,partnerSseRealm:string) { + partnerSSERealmPath( + project: string, + location: string, + partnerSseRealm: string, + ) { return this.pathTemplates.partnerSSERealmPathTemplate.render({ project: project, location: location, @@ -3676,7 +4789,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).project; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).project; } /** @@ -3687,7 +4802,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).location; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).location; } /** @@ -3698,7 +4815,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the partner_sse_realm. */ matchPartnerSseRealmFromPartnerSSERealmName(partnerSSERealmName: string) { - return this.pathTemplates.partnerSSERealmPathTemplate.match(partnerSSERealmName).partner_sse_realm; + return this.pathTemplates.partnerSSERealmPathTemplate.match( + partnerSSERealmName, + ).partner_sse_realm; } /** @@ -3707,7 +4826,7 @@ export class SSERealmServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3732,12 +4851,18 @@ export class SSERealmServiceClient { * @param {string} firewall_endpoint * @returns {string} Resource name string. */ - projectLocationFirewallEndpointsPath(project:string,location:string,firewallEndpoint:string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render({ - project: project, - location: location, - firewall_endpoint: firewallEndpoint, - }); + projectLocationFirewallEndpointsPath( + project: string, + location: string, + firewallEndpoint: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render( + { + project: project, + location: location, + firewall_endpoint: firewallEndpoint, + }, + ); } /** @@ -3747,8 +4872,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).project; + matchProjectFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).project; } /** @@ -3758,8 +4887,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).location; + matchLocationFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).location; } /** @@ -3769,8 +4902,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_firewallEndpoints resource. * @returns {string} A string representing the firewall_endpoint. */ - matchFirewallEndpointFromProjectLocationFirewallEndpointsName(projectLocationFirewallEndpointsName: string) { - return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match(projectLocationFirewallEndpointsName).firewall_endpoint; + matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + projectLocationFirewallEndpointsName: string, + ) { + return this.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match( + projectLocationFirewallEndpointsName, + ).firewall_endpoint; } /** @@ -3781,12 +4918,18 @@ export class SSERealmServiceClient { * @param {string} security_profile * @returns {string} Resource name string. */ - projectLocationSecurityProfilePath(project:string,location:string,securityProfile:string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render({ - project: project, - location: location, - security_profile: securityProfile, - }); + projectLocationSecurityProfilePath( + project: string, + location: string, + securityProfile: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.render( + { + project: project, + location: location, + security_profile: securityProfile, + }, + ); } /** @@ -3796,8 +4939,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).project; + matchProjectFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).project; } /** @@ -3807,8 +4954,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).location; + matchLocationFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).location; } /** @@ -3818,8 +4969,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile resource. * @returns {string} A string representing the security_profile. */ - matchSecurityProfileFromProjectLocationSecurityProfileName(projectLocationSecurityProfileName: string) { - return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match(projectLocationSecurityProfileName).security_profile; + matchSecurityProfileFromProjectLocationSecurityProfileName( + projectLocationSecurityProfileName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfilePathTemplate.match( + projectLocationSecurityProfileName, + ).security_profile; } /** @@ -3830,12 +4985,18 @@ export class SSERealmServiceClient { * @param {string} security_profile_group * @returns {string} Resource name string. */ - projectLocationSecurityProfileGroupPath(project:string,location:string,securityProfileGroup:string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render({ - project: project, - location: location, - security_profile_group: securityProfileGroup, - }); + projectLocationSecurityProfileGroupPath( + project: string, + location: string, + securityProfileGroup: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render( + { + project: project, + location: location, + security_profile_group: securityProfileGroup, + }, + ); } /** @@ -3845,8 +5006,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).project; + matchProjectFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).project; } /** @@ -3856,8 +5021,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the location. */ - matchLocationFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).location; + matchLocationFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).location; } /** @@ -3867,8 +5036,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing project_location_security_profile_group resource. * @returns {string} A string representing the security_profile_group. */ - matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(projectLocationSecurityProfileGroupName: string) { - return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match(projectLocationSecurityProfileGroupName).security_profile_group; + matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + projectLocationSecurityProfileGroupName: string, + ) { + return this.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match( + projectLocationSecurityProfileGroupName, + ).security_profile_group; } /** @@ -3879,7 +5052,7 @@ export class SSERealmServiceClient { * @param {string} sac_attachment * @returns {string} Resource name string. */ - sACAttachmentPath(project:string,location:string,sacAttachment:string) { + sACAttachmentPath(project: string, location: string, sacAttachment: string) { return this.pathTemplates.sACAttachmentPathTemplate.render({ project: project, location: location, @@ -3895,7 +5068,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).project; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .project; } /** @@ -3906,7 +5080,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).location; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .location; } /** @@ -3917,7 +5092,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the sac_attachment. */ matchSacAttachmentFromSACAttachmentName(sACAttachmentName: string) { - return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName).sac_attachment; + return this.pathTemplates.sACAttachmentPathTemplate.match(sACAttachmentName) + .sac_attachment; } /** @@ -3928,7 +5104,7 @@ export class SSERealmServiceClient { * @param {string} sac_realm * @returns {string} Resource name string. */ - sACRealmPath(project:string,location:string,sacRealm:string) { + sACRealmPath(project: string, location: string, sacRealm: string) { return this.pathTemplates.sACRealmPathTemplate.render({ project: project, location: location, @@ -3966,7 +5142,8 @@ export class SSERealmServiceClient { * @returns {string} A string representing the sac_realm. */ matchSacRealmFromSACRealmName(sACRealmName: string) { - return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName).sac_realm; + return this.pathTemplates.sACRealmPathTemplate.match(sACRealmName) + .sac_realm; } /** @@ -3977,7 +5154,11 @@ export class SSERealmServiceClient { * @param {string} sse_gateway_reference * @returns {string} Resource name string. */ - sSEGatewayReferencePath(project:string,location:string,sseGatewayReference:string) { + sSEGatewayReferencePath( + project: string, + location: string, + sseGatewayReference: string, + ) { return this.pathTemplates.sSEGatewayReferencePathTemplate.render({ project: project, location: location, @@ -3993,7 +5174,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).project; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).project; } /** @@ -4004,7 +5187,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).location; + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).location; } /** @@ -4014,8 +5199,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing SSEGatewayReference resource. * @returns {string} A string representing the sse_gateway_reference. */ - matchSseGatewayReferenceFromSSEGatewayReferenceName(sSEGatewayReferenceName: string) { - return this.pathTemplates.sSEGatewayReferencePathTemplate.match(sSEGatewayReferenceName).sse_gateway_reference; + matchSseGatewayReferenceFromSSEGatewayReferenceName( + sSEGatewayReferenceName: string, + ) { + return this.pathTemplates.sSEGatewayReferencePathTemplate.match( + sSEGatewayReferenceName, + ).sse_gateway_reference; } /** @@ -4026,7 +5215,11 @@ export class SSERealmServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -4042,7 +5235,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -4053,7 +5248,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -4064,7 +5261,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -4075,7 +5274,11 @@ export class SSERealmServiceClient { * @param {string} tls_inspection_policy * @returns {string} Resource name string. */ - tlsInspectionPolicyPath(project:string,location:string,tlsInspectionPolicy:string) { + tlsInspectionPolicyPath( + project: string, + location: string, + tlsInspectionPolicy: string, + ) { return this.pathTemplates.tlsInspectionPolicyPathTemplate.render({ project: project, location: location, @@ -4091,7 +5294,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the project. */ matchProjectFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).project; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).project; } /** @@ -4102,7 +5307,9 @@ export class SSERealmServiceClient { * @returns {string} A string representing the location. */ matchLocationFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).location; + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).location; } /** @@ -4112,8 +5319,12 @@ export class SSERealmServiceClient { * A fully-qualified path representing TlsInspectionPolicy resource. * @returns {string} A string representing the tls_inspection_policy. */ - matchTlsInspectionPolicyFromTlsInspectionPolicyName(tlsInspectionPolicyName: string) { - return this.pathTemplates.tlsInspectionPolicyPathTemplate.match(tlsInspectionPolicyName).tls_inspection_policy; + matchTlsInspectionPolicyFromTlsInspectionPolicyName( + tlsInspectionPolicyName: string, + ) { + return this.pathTemplates.tlsInspectionPolicyPathTemplate.match( + tlsInspectionPolicyName, + ).tls_inspection_policy; } /** @@ -4124,7 +5335,7 @@ export class SSERealmServiceClient { * @param {string} url_list * @returns {string} Resource name string. */ - urlListPath(project:string,location:string,urlList:string) { + urlListPath(project: string, location: string, urlList: string) { return this.pathTemplates.urlListPathTemplate.render({ project: project, location: location, @@ -4173,15 +5384,19 @@ export class SSERealmServiceClient { */ close(): Promise { if (this.sSERealmServiceStub && !this._terminated) { - return this.sSERealmServiceStub.then(stub => { + return this.sSERealmServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1beta1/dns_threat_detector_service_client.ts b/packages/google-cloud-networksecurity/src/v1beta1/dns_threat_detector_service_client.ts index 9a228351c41a..e0331bb8f833 100644 --- a/packages/google-cloud-networksecurity/src/v1beta1/dns_threat_detector_service_client.ts +++ b/packages/google-cloud-networksecurity/src/v1beta1/dns_threat_detector_service_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +55,7 @@ export class DnsThreatDetectorServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -57,11 +68,11 @@ export class DnsThreatDetectorServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - dnsThreatDetectorServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + dnsThreatDetectorServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of DnsThreatDetectorServiceClient. @@ -102,21 +113,43 @@ export class DnsThreatDetectorServiceClient { * const client = new DnsThreatDetectorServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DnsThreatDetectorServiceClient; - 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 staticMembers = this + .constructor as typeof DnsThreatDetectorServiceClient; + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -141,7 +174,7 @@ export class DnsThreatDetectorServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,18 +187,14 @@ export class DnsThreatDetectorServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -187,25 +216,25 @@ export class DnsThreatDetectorServiceClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' + 'projects/{project}/global/networks/{network}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), }; @@ -213,14 +242,20 @@ export class DnsThreatDetectorServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listDnsThreatDetectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dnsThreatDetectors') + listDnsThreatDetectors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dnsThreatDetectors', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1beta1.DnsThreatDetectorService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1beta1.DnsThreatDetectorService', + 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 @@ -251,37 +286,47 @@ export class DnsThreatDetectorServiceClient { // Put together the "service stub" for // google.cloud.networksecurity.v1beta1.DnsThreatDetectorService. this.dnsThreatDetectorServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1beta1.DnsThreatDetectorService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1beta1.DnsThreatDetectorService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1beta1.DnsThreatDetectorService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1beta1 + .DnsThreatDetectorService, + 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 dnsThreatDetectorServiceStubMethods = - ['listDnsThreatDetectors', 'getDnsThreatDetector', 'createDnsThreatDetector', 'updateDnsThreatDetector', 'deleteDnsThreatDetector']; + const dnsThreatDetectorServiceStubMethods = [ + 'listDnsThreatDetectors', + 'getDnsThreatDetector', + 'createDnsThreatDetector', + 'updateDnsThreatDetector', + 'deleteDnsThreatDetector', + ]; for (const methodName of dnsThreatDetectorServiceStubMethods) { const callPromise = this.dnsThreatDetectorServiceStub.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) => () => { + (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] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -296,8 +341,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -308,8 +359,14 @@ export class DnsThreatDetectorServiceClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -340,9 +397,7 @@ export class DnsThreatDetectorServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -351,8 +406,9 @@ export class DnsThreatDetectorServiceClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -363,478 +419,699 @@ export class DnsThreatDetectorServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets the details of a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1beta1/dns_threat_detector_service.get_dns_threat_detector.js - * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async - */ + /** + * Gets the details of a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1beta1/dns_threat_detector_service.get_dns_threat_detector.js + * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_GetDnsThreatDetector_async + */ getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new DnsThreatDetector in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The value for the parent of the DnsThreatDetector resource. - * @param {string} [request.dnsThreatDetectorId] - * Optional. The ID of the requesting DnsThreatDetector object. - * If this field is not supplied, the service generates an identifier. - * @param {google.cloud.networksecurity.v1beta1.DnsThreatDetector} request.dnsThreatDetector - * Required. The `DnsThreatDetector` resource to create. - * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1beta1/dns_threat_detector_service.create_dns_threat_detector.js - * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async - */ + /** + * Creates a new DnsThreatDetector in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The value for the parent of the DnsThreatDetector resource. + * @param {string} [request.dnsThreatDetectorId] + * Optional. The ID of the requesting DnsThreatDetector object. + * If this field is not supplied, the service generates an identifier. + * @param {google.cloud.networksecurity.v1beta1.DnsThreatDetector} request.dnsThreatDetector + * Required. The `DnsThreatDetector` resource to create. + * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1beta1/dns_threat_detector_service.create_dns_threat_detector.js + * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_CreateDnsThreatDetector_async + */ createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.ICreateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The field mask is used to specify the fields to be overwritten in - * the DnsThreatDetector resource by the update. The fields specified in the - * update_mask are relative to the resource, not the full request. A field - * will be overwritten if it is in the mask. If the mask is not provided then - * all fields present in the request will be overwritten. - * @param {google.cloud.networksecurity.v1beta1.DnsThreatDetector} request.dnsThreatDetector - * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. - * 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/v1beta1/dns_threat_detector_service.update_dns_threat_detector.js - * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async - */ + /** + * Updates a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The field mask is used to specify the fields to be overwritten in + * the DnsThreatDetector resource by the update. The fields specified in the + * update_mask are relative to the resource, not the full request. A field + * will be overwritten if it is in the mask. If the mask is not provided then + * all fields present in the request will be overwritten. + * @param {google.cloud.networksecurity.v1beta1.DnsThreatDetector} request.dnsThreatDetector + * Required. The DnsThreatDetector resource being 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 {@link protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. + * 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/v1beta1/dns_threat_detector_service.update_dns_threat_detector.js + * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_UpdateDnsThreatDetector_async + */ updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'dns_threat_detector.name': request.dnsThreatDetector!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, - protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector, + ( + | protos.google.cloud.networksecurity.v1beta1.IUpdateDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a single DnsThreatDetector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. - * 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/v1beta1/dns_threat_detector_service.delete_dns_threat_detector.js - * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async - */ + /** + * Deletes a single DnsThreatDetector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the DnsThreatDetector 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 {@link protos.google.protobuf.Empty|Empty}. + * 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/v1beta1/dns_threat_detector_service.delete_dns_threat_detector.js + * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_DeleteDnsThreatDetector_async + */ deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + >; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDnsThreatDetector( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteDnsThreatDetector request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteDnsThreatDetector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteDnsThreatDetector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDnsThreatDetector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteDnsThreatDetector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.networksecurity.v1beta1.IDeleteDnsThreatDetectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteDnsThreatDetector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists DnsThreatDetectors in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. - * 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Lists DnsThreatDetectors in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. + * 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse, + ] + >; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector + >, + ): void; listDnsThreatDetectors( - request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + | protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDnsThreatDetectors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -843,139 +1120,143 @@ export class DnsThreatDetectorServiceClient { this._log.info('listDnsThreatDetectors request %j', request); return this.innerApiCalls .listDnsThreatDetectors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse - ]) => { - this._log.info('listDnsThreatDetectors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[], + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsResponse, + ]) => { + this._log.info('listDnsThreatDetectors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` - * 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. - */ + /** + * Equivalent to `listDnsThreatDetectors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector} 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 `listDnsThreatDetectorsAsync()` + * 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. + */ listDnsThreatDetectorsStream( - request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors stream %j', request); return this.descriptors.page.listDnsThreatDetectors.createStream( this.innerApiCalls.listDnsThreatDetectors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. - * @param {number} [request.pageSize] - * Optional. The requested page size. The server may return fewer items than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous - * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the - * subsequent page. - * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. 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/v1beta1/dns_threat_detector_service.list_dns_threat_detectors.js - * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async - */ + /** + * Equivalent to `listDnsThreatDetectors`, 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 value for `ListDnsThreatDetectorsRequest`. + * @param {number} [request.pageSize] + * Optional. The requested page size. The server may return fewer items than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous + * `ListDnsThreatDetectorsRequest` call. Provide this to retrieve the + * subsequent page. + * @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.networksecurity.v1beta1.DnsThreatDetector|DnsThreatDetector}. 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/v1beta1/dns_threat_detector_service.list_dns_threat_detectors.js + * region_tag:networksecurity_v1beta1_generated_DnsThreatDetectorService_ListDnsThreatDetectors_async + */ listDnsThreatDetectorsAsync( - request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1beta1.IListDnsThreatDetectorsRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDnsThreatDetectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDnsThreatDetectors iterate %j', request); return this.descriptors.page.listDnsThreatDetectors.asyncIterate( this.innerApiCalls['listDnsThreatDetectors'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -989,40 +1270,40 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -1036,41 +1317,41 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -1084,12 +1365,12 @@ export class DnsThreatDetectorServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -1124,12 +1405,11 @@ export class DnsThreatDetectorServiceClient { | 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. @@ -1162,7 +1442,7 @@ export class DnsThreatDetectorServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1179,7 +1459,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -1195,7 +1479,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -1206,7 +1492,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -1216,8 +1504,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -1228,7 +1520,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -1244,7 +1540,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -1255,7 +1553,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -1266,7 +1566,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -1277,7 +1579,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -1293,7 +1599,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -1304,7 +1612,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -1314,8 +1624,12 @@ export class DnsThreatDetectorServiceClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -1325,7 +1639,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1361,7 +1675,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -1396,7 +1710,7 @@ export class DnsThreatDetectorServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1421,7 +1735,11 @@ export class DnsThreatDetectorServiceClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -1437,7 +1755,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -1448,7 +1768,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -1459,7 +1781,9 @@ export class DnsThreatDetectorServiceClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -1470,14 +1794,18 @@ export class DnsThreatDetectorServiceClient { */ close(): Promise { if (this.dnsThreatDetectorServiceStub && !this._terminated) { - return this.dnsThreatDetectorServiceStub.then(stub => { + return this.dnsThreatDetectorServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/src/v1beta1/index.ts b/packages/google-cloud-networksecurity/src/v1beta1/index.ts index 96584e765ad7..ee7fa63018c4 100644 --- a/packages/google-cloud-networksecurity/src/v1beta1/index.ts +++ b/packages/google-cloud-networksecurity/src/v1beta1/index.ts @@ -16,5 +16,5 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {DnsThreatDetectorServiceClient} from './dns_threat_detector_service_client'; -export {NetworkSecurityClient} from './network_security_client'; +export { DnsThreatDetectorServiceClient } from './dns_threat_detector_service_client'; +export { NetworkSecurityClient } from './network_security_client'; diff --git a/packages/google-cloud-networksecurity/src/v1beta1/network_security_client.ts b/packages/google-cloud-networksecurity/src/v1beta1/network_security_client.ts index dba4434fdee1..168fb5d519c2 100644 --- a/packages/google-cloud-networksecurity/src/v1beta1/network_security_client.ts +++ b/packages/google-cloud-networksecurity/src/v1beta1/network_security_client.ts @@ -18,11 +18,24 @@ /* 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 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'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +59,7 @@ export class NetworkSecurityClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('network-security'); @@ -59,12 +72,12 @@ export class NetworkSecurityClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - networkSecurityStub?: Promise<{[name: string]: Function}>; + networkSecurityStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of NetworkSecurityClient. @@ -105,21 +118,42 @@ export class NetworkSecurityClient { * const client = new NetworkSecurityClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NetworkSecurityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + 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'; + 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 = 'networksecurity.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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); + 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; @@ -144,7 +178,7 @@ export class NetworkSecurityClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,18 +191,14 @@ export class NetworkSecurityClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -190,16 +220,16 @@ export class NetworkSecurityClient { // Create useful helper objects for these. this.pathTemplates = { authorizationPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}' + 'projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}', ), clientTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}' + 'projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}', ), dnsThreatDetectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}' + 'projects/{project}/locations/{location}/dnsThreatDetectors/{dns_threat_detector}', ), serverTlsPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}' + 'projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}', ), }; @@ -207,12 +237,21 @@ export class NetworkSecurityClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAuthorizationPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'authorizationPolicies'), - listServerTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serverTlsPolicies'), - listClientTlsPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clientTlsPolicies') + listAuthorizationPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'authorizationPolicies', + ), + listServerTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'serverTlsPolicies', + ), + listClientTlsPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'clientTlsPolicies', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -221,96 +260,229 @@ export class NetworkSecurityClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy',},{get: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1beta1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy', + }, + { + get: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1beta1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1beta1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1beta1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.AuthorizationPolicy', + ) as gax.protobuf.Type; const createAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const updateAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.AuthorizationPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.AuthorizationPolicy', + ) as gax.protobuf.Type; const updateAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAuthorizationPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const createServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.ServerTlsPolicy', + ) as gax.protobuf.Type; const createServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const updateServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.ServerTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.ServerTlsPolicy', + ) as gax.protobuf.Type; const updateServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const deleteServerTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteServerTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const createClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.ClientTlsPolicy', + ) as gax.protobuf.Type; const createClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const updateClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.ClientTlsPolicy') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.ClientTlsPolicy', + ) as gax.protobuf.Type; const updateClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; const deleteClientTlsPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteClientTlsPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.networksecurity.v1beta1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.networksecurity.v1beta1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createAuthorizationPolicyResponse.decode.bind(createAuthorizationPolicyResponse), - createAuthorizationPolicyMetadata.decode.bind(createAuthorizationPolicyMetadata)), + createAuthorizationPolicyResponse.decode.bind( + createAuthorizationPolicyResponse, + ), + createAuthorizationPolicyMetadata.decode.bind( + createAuthorizationPolicyMetadata, + ), + ), updateAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateAuthorizationPolicyResponse.decode.bind(updateAuthorizationPolicyResponse), - updateAuthorizationPolicyMetadata.decode.bind(updateAuthorizationPolicyMetadata)), + updateAuthorizationPolicyResponse.decode.bind( + updateAuthorizationPolicyResponse, + ), + updateAuthorizationPolicyMetadata.decode.bind( + updateAuthorizationPolicyMetadata, + ), + ), deleteAuthorizationPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteAuthorizationPolicyResponse.decode.bind(deleteAuthorizationPolicyResponse), - deleteAuthorizationPolicyMetadata.decode.bind(deleteAuthorizationPolicyMetadata)), + deleteAuthorizationPolicyResponse.decode.bind( + deleteAuthorizationPolicyResponse, + ), + deleteAuthorizationPolicyMetadata.decode.bind( + deleteAuthorizationPolicyMetadata, + ), + ), createServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createServerTlsPolicyResponse.decode.bind(createServerTlsPolicyResponse), - createServerTlsPolicyMetadata.decode.bind(createServerTlsPolicyMetadata)), + createServerTlsPolicyResponse.decode.bind( + createServerTlsPolicyResponse, + ), + createServerTlsPolicyMetadata.decode.bind( + createServerTlsPolicyMetadata, + ), + ), updateServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateServerTlsPolicyResponse.decode.bind(updateServerTlsPolicyResponse), - updateServerTlsPolicyMetadata.decode.bind(updateServerTlsPolicyMetadata)), + updateServerTlsPolicyResponse.decode.bind( + updateServerTlsPolicyResponse, + ), + updateServerTlsPolicyMetadata.decode.bind( + updateServerTlsPolicyMetadata, + ), + ), deleteServerTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteServerTlsPolicyResponse.decode.bind(deleteServerTlsPolicyResponse), - deleteServerTlsPolicyMetadata.decode.bind(deleteServerTlsPolicyMetadata)), + deleteServerTlsPolicyResponse.decode.bind( + deleteServerTlsPolicyResponse, + ), + deleteServerTlsPolicyMetadata.decode.bind( + deleteServerTlsPolicyMetadata, + ), + ), createClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createClientTlsPolicyResponse.decode.bind(createClientTlsPolicyResponse), - createClientTlsPolicyMetadata.decode.bind(createClientTlsPolicyMetadata)), + createClientTlsPolicyResponse.decode.bind( + createClientTlsPolicyResponse, + ), + createClientTlsPolicyMetadata.decode.bind( + createClientTlsPolicyMetadata, + ), + ), updateClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateClientTlsPolicyResponse.decode.bind(updateClientTlsPolicyResponse), - updateClientTlsPolicyMetadata.decode.bind(updateClientTlsPolicyMetadata)), + updateClientTlsPolicyResponse.decode.bind( + updateClientTlsPolicyResponse, + ), + updateClientTlsPolicyMetadata.decode.bind( + updateClientTlsPolicyMetadata, + ), + ), deleteClientTlsPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteClientTlsPolicyResponse.decode.bind(deleteClientTlsPolicyResponse), - deleteClientTlsPolicyMetadata.decode.bind(deleteClientTlsPolicyMetadata)) + deleteClientTlsPolicyResponse.decode.bind( + deleteClientTlsPolicyResponse, + ), + deleteClientTlsPolicyMetadata.decode.bind( + deleteClientTlsPolicyMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networksecurity.v1beta1.NetworkSecurity', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.networksecurity.v1beta1.NetworkSecurity', + 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 @@ -341,28 +513,50 @@ export class NetworkSecurityClient { // Put together the "service stub" for // google.cloud.networksecurity.v1beta1.NetworkSecurity. this.networkSecurityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networksecurity.v1beta1.NetworkSecurity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networksecurity.v1beta1.NetworkSecurity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networksecurity.v1beta1.NetworkSecurity', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networksecurity.v1beta1 + .NetworkSecurity, + 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 networkSecurityStubMethods = - ['listAuthorizationPolicies', 'getAuthorizationPolicy', 'createAuthorizationPolicy', 'updateAuthorizationPolicy', 'deleteAuthorizationPolicy', 'listServerTlsPolicies', 'getServerTlsPolicy', 'createServerTlsPolicy', 'updateServerTlsPolicy', 'deleteServerTlsPolicy', 'listClientTlsPolicies', 'getClientTlsPolicy', 'createClientTlsPolicy', 'updateClientTlsPolicy', 'deleteClientTlsPolicy']; + const networkSecurityStubMethods = [ + 'listAuthorizationPolicies', + 'getAuthorizationPolicy', + 'createAuthorizationPolicy', + 'updateAuthorizationPolicy', + 'deleteAuthorizationPolicy', + 'listServerTlsPolicies', + 'getServerTlsPolicy', + 'createServerTlsPolicy', + 'updateServerTlsPolicy', + 'deleteServerTlsPolicy', + 'listClientTlsPolicies', + 'getClientTlsPolicy', + 'createClientTlsPolicy', + 'updateClientTlsPolicy', + 'deleteClientTlsPolicy', + ]; for (const methodName of networkSecurityStubMethods) { const callPromise = this.networkSecurityStub.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) => () => { + (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] || @@ -372,7 +566,7 @@ export class NetworkSecurityClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -387,8 +581,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -399,8 +599,14 @@ export class NetworkSecurityClient { * @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'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'networksecurity.googleapis.com'; } @@ -431,9 +637,7 @@ export class NetworkSecurityClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -442,8 +646,9 @@ export class NetworkSecurityClient { * 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 { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -454,1388 +659,2118 @@ export class NetworkSecurityClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to get. Must be in the format - * `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. - * 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/v1beta1/network_security.get_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_async - */ + /** + * Gets details of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to get. Must be in the format + * `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. + * 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/v1beta1/network_security.get_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_async + */ getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAuthorizationPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAuthorizationPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAuthorizationPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetAuthorizationPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getAuthorizationPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. - * 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/v1beta1/network_security.get_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetServerTlsPolicy_async - */ + /** + * Gets details of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. + * 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/v1beta1/network_security.get_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetServerTlsPolicy_async + */ getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getServerTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getServerTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServerTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetServerTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getServerTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to get. Must be in the format - * `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. - * 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/v1beta1/network_security.get_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetClientTlsPolicy_async - */ + /** + * Gets details of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to get. Must be in the format + * `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. + * 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/v1beta1/network_security.get_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_GetClientTlsPolicy_async + */ getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + >; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, - callback: Callback< - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, + callback: Callback< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getClientTlsPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getClientTlsPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, - protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getClientTlsPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + ( + | protos.google.cloud.networksecurity.v1beta1.IGetClientTlsPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getClientTlsPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new AuthorizationPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the AuthorizationPolicy. Must be in the - * format `projects/{project}/locations/{location}`. - * @param {string} request.authorizationPolicyId - * Required. Short name of the AuthorizationPolicy resource to be created. - * This value should be 1-63 characters long, containing only - * letters, numbers, hyphens, and underscores, and should not start - * with a number. E.g. "authz_policy". - * @param {google.cloud.networksecurity.v1beta1.AuthorizationPolicy} request.authorizationPolicy - * Required. AuthorizationPolicy resource to be created. - * @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/v1beta1/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ + /** + * Creates a new AuthorizationPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the AuthorizationPolicy. Must be in the + * format `projects/{project}/locations/{location}`. + * @param {string} request.authorizationPolicyId + * Required. Short name of the AuthorizationPolicy resource to be created. + * This value should be 1-63 characters long, containing only + * letters, numbers, hyphens, and underscores, and should not start + * with a number. E.g. "authz_policy". + * @param {google.cloud.networksecurity.v1beta1.AuthorizationPolicy} request.authorizationPolicy + * Required. AuthorizationPolicy resource to be created. + * @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/v1beta1/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.ICreateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAuthorizationPolicy request %j', request); - return this.innerApiCalls.createAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAuthorizationPolicy()`. - * @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/v1beta1/network_security.create_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_async - */ - async checkCreateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAuthorizationPolicy()`. + * @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/v1beta1/network_security.create_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_async + */ + async checkCreateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('createAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Updates the parameters of a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * AuthorizationPolicy resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.networksecurity.v1beta1.AuthorizationPolicy} request.authorizationPolicy - * Required. Updated AuthorizationPolicy 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/v1beta1/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ + /** + * Updates the parameters of a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * AuthorizationPolicy resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.networksecurity.v1beta1.AuthorizationPolicy} request.authorizationPolicy + * Required. Updated AuthorizationPolicy 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/v1beta1/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'authorization_policy.name': request.authorizationPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { this._log.info('updateAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAuthorizationPolicy request %j', request); - return this.innerApiCalls.updateAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. - * @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/v1beta1/network_security.update_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async - */ - async checkUpdateAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAuthorizationPolicy()`. + * @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/v1beta1/network_security.update_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async + */ + async checkUpdateAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('updateAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Deletes a single AuthorizationPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the AuthorizationPolicy to delete. Must be in the - * format `projects/{project}/locations/{location}/authorizationPolicies/*`. - * @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/v1beta1/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ + /** + * Deletes a single AuthorizationPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the AuthorizationPolicy to delete. Must be in the + * format `projects/{project}/locations/{location}/authorizationPolicies/*`. + * @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/v1beta1/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAuthorizationPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteAuthorizationPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAuthorizationPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAuthorizationPolicy request %j', request); - return this.innerApiCalls.deleteAuthorizationPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAuthorizationPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAuthorizationPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAuthorizationPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. - * @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/v1beta1/network_security.delete_authorization_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async - */ - async checkDeleteAuthorizationPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAuthorizationPolicy()`. + * @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/v1beta1/network_security.delete_authorization_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async + */ + async checkDeleteAuthorizationPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('deleteAuthorizationPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteAuthorizationPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAuthorizationPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Creates a new ServerTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ServerTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.serverTlsPolicyId - * Required. Short name of the ServerTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "server_mtls_policy". - * @param {google.cloud.networksecurity.v1beta1.ServerTlsPolicy} request.serverTlsPolicy - * Required. ServerTlsPolicy resource to be created. - * @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/v1beta1/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ + /** + * Creates a new ServerTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ServerTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.serverTlsPolicyId + * Required. Short name of the ServerTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "server_mtls_policy". + * @param {google.cloud.networksecurity.v1beta1.ServerTlsPolicy} request.serverTlsPolicy + * Required. ServerTlsPolicy resource to be created. + * @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/v1beta1/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.ICreateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createServerTlsPolicy request %j', request); - return this.innerApiCalls.createServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createServerTlsPolicy()`. - * @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/v1beta1/network_security.create_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_async - */ - async checkCreateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createServerTlsPolicy()`. + * @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/v1beta1/network_security.create_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_async + */ + async checkCreateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('createServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Updates the parameters of a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ServerTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1beta1.ServerTlsPolicy} request.serverTlsPolicy - * Required. Updated ServerTlsPolicy 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/v1beta1/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ + /** + * Updates the parameters of a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ServerTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1beta1.ServerTlsPolicy} request.serverTlsPolicy + * Required. Updated ServerTlsPolicy 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/v1beta1/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'server_tls_policy.name': request.serverTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateServerTlsPolicy request %j', request); - return this.innerApiCalls.updateServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateServerTlsPolicy()`. - * @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/v1beta1/network_security.update_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_async - */ - async checkUpdateServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateServerTlsPolicy()`. + * @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/v1beta1/network_security.update_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_async + */ + async checkUpdateServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('updateServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Deletes a single ServerTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ServerTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/serverTlsPolicies/*`. - * @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/v1beta1/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ + /** + * Deletes a single ServerTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ServerTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/serverTlsPolicies/*`. + * @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/v1beta1/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteServerTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteServerTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteServerTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteServerTlsPolicy request %j', request); - return this.innerApiCalls.deleteServerTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteServerTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteServerTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteServerTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. - * @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/v1beta1/network_security.delete_server_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_async - */ - async checkDeleteServerTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteServerTlsPolicy()`. + * @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/v1beta1/network_security.delete_server_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_async + */ + async checkDeleteServerTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('deleteServerTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteServerTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteServerTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Creates a new ClientTlsPolicy in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ClientTlsPolicy. Must be in - * the format `projects/* /locations/{location}`. - * @param {string} request.clientTlsPolicyId - * Required. Short name of the ClientTlsPolicy resource to be created. This - * value should be 1-63 characters long, containing only letters, numbers, - * hyphens, and underscores, and should not start with a number. E.g. - * "client_mtls_policy". - * @param {google.cloud.networksecurity.v1beta1.ClientTlsPolicy} request.clientTlsPolicy - * Required. ClientTlsPolicy resource to be created. - * @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/v1beta1/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ + /** + * Creates a new ClientTlsPolicy in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ClientTlsPolicy. Must be in + * the format `projects/* /locations/{location}`. + * @param {string} request.clientTlsPolicyId + * Required. Short name of the ClientTlsPolicy resource to be created. This + * value should be 1-63 characters long, containing only letters, numbers, + * hyphens, and underscores, and should not start with a number. E.g. + * "client_mtls_policy". + * @param {google.cloud.networksecurity.v1beta1.ClientTlsPolicy} request.clientTlsPolicy + * Required. ClientTlsPolicy resource to be created. + * @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/v1beta1/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.ICreateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createClientTlsPolicy request %j', request); - return this.innerApiCalls.createClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createClientTlsPolicy()`. - * @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/v1beta1/network_security.create_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_async - */ - async checkCreateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createClientTlsPolicy()`. + * @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/v1beta1/network_security.create_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_async + */ + async checkCreateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('createClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.createClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Updates the parameters of a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ClientTlsPolicy resource by the update. The fields - * specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the - * mask. If the user does not provide a mask then all fields will be - * overwritten. - * @param {google.cloud.networksecurity.v1beta1.ClientTlsPolicy} request.clientTlsPolicy - * Required. Updated ClientTlsPolicy 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/v1beta1/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ + /** + * Updates the parameters of a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ClientTlsPolicy resource by the update. The fields + * specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the + * mask. If the user does not provide a mask then all fields will be + * overwritten. + * @param {google.cloud.networksecurity.v1beta1.ClientTlsPolicy} request.clientTlsPolicy + * Required. Updated ClientTlsPolicy 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/v1beta1/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IUpdateClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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({ - 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'client_tls_policy.name': request.clientTlsPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateClientTlsPolicy request %j', request); - return this.innerApiCalls.updateClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateClientTlsPolicy()`. - * @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/v1beta1/network_security.update_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_async - */ - async checkUpdateClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateClientTlsPolicy()`. + * @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/v1beta1/network_security.update_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_async + */ + async checkUpdateClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('updateClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.updateClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; } -/** - * Deletes a single ClientTlsPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A name of the ClientTlsPolicy to delete. Must be in - * the format `projects/* /locations/{location}/clientTlsPolicies/*`. - * @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/v1beta1/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ + /** + * Deletes a single ClientTlsPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A name of the ClientTlsPolicy to delete. Must be in + * the format `projects/* /locations/{location}/clientTlsPolicies/*`. + * @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/v1beta1/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteClientTlsPolicy( - request?: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.networksecurity.v1beta1.IDeleteClientTlsPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteClientTlsPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteClientTlsPolicy request %j', request); - return this.innerApiCalls.deleteClientTlsPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteClientTlsPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteClientTlsPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteClientTlsPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. - * @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/v1beta1/network_security.delete_client_tls_policy.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_async - */ - async checkDeleteClientTlsPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteClientTlsPolicy()`. + * @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/v1beta1/network_security.delete_client_tls_policy.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_async + */ + async checkDeleteClientTlsPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + > + > { this._log.info('deleteClientTlsPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + 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.deleteClientTlsPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists AuthorizationPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. - * 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteClientTlsPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networksecurity.v1beta1.OperationMetadata + >; + } + /** + * Lists AuthorizationPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. + * 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse, + ] + >; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy + >, + ): void; listAuthorizationPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAuthorizationPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1844,203 +2779,232 @@ export class NetworkSecurityClient { this._log.info('listAuthorizationPolicies request %j', request); return this.innerApiCalls .listAuthorizationPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse - ]) => { - this._log.info('listAuthorizationPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesResponse, + ]) => { + this._log.info('listAuthorizationPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listAuthorizationPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy} 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 `listAuthorizationPoliciesAsync()` + * 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. + */ listAuthorizationPoliciesStream( - request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies stream %j', request); return this.descriptors.page.listAuthorizationPolicies.createStream( this.innerApiCalls.listAuthorizationPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies - * should be listed, specified in the format - * `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * Maximum number of AuthorizationPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListAuthorizationPoliciesResponse` Indicates that this is a - * continuation of a prior `ListAuthorizationPolicies` call, and - * that the system should return the next page of data. - * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. 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/v1beta1/network_security.list_authorization_policies.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListAuthorizationPolicies_async - */ + /** + * Equivalent to `listAuthorizationPolicies`, 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 project and location from which the AuthorizationPolicies + * should be listed, specified in the format + * `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * Maximum number of AuthorizationPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListAuthorizationPoliciesResponse` Indicates that this is a + * continuation of a prior `ListAuthorizationPolicies` call, and + * that the system should return the next page of data. + * @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.networksecurity.v1beta1.AuthorizationPolicy|AuthorizationPolicy}. 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/v1beta1/network_security.list_authorization_policies.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListAuthorizationPolicies_async + */ listAuthorizationPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1beta1.IListAuthorizationPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAuthorizationPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAuthorizationPolicies iterate %j', request); return this.descriptors.page.listAuthorizationPolicies.asyncIterate( this.innerApiCalls['listAuthorizationPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ServerTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. - * 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ServerTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. + * 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse, + ] + >; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy + >, + ): void; listServerTlsPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listServerTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2049,201 +3013,230 @@ export class NetworkSecurityClient { this._log.info('listServerTlsPolicies request %j', request); return this.innerApiCalls .listServerTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse - ]) => { - this._log.info('listServerTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesResponse, + ]) => { + this._log.info('listServerTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listServerTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy} 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 `listServerTlsPoliciesAsync()` + * 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. + */ listServerTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies stream %j', request); return this.descriptors.page.listServerTlsPolicies.createStream( this.innerApiCalls.listServerTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ServerTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListServerTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListServerTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. 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/v1beta1/network_security.list_server_tls_policies.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListServerTlsPolicies_async - */ + /** + * Equivalent to `listServerTlsPolicies`, 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 project and location from which the ServerTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ServerTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListServerTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListServerTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ServerTlsPolicy|ServerTlsPolicy}. 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/v1beta1/network_security.list_server_tls_policies.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListServerTlsPolicies_async + */ listServerTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1beta1.IListServerTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServerTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServerTlsPolicies iterate %j', request); return this.descriptors.page.listServerTlsPolicies.asyncIterate( this.innerApiCalls['listServerTlsPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ClientTlsPolicies in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. - * 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Lists ClientTlsPolicies in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. + * 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse - ]>; + request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse, + ] + >; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy>): void; + request: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy + >, + ): void; listClientTlsPolicies( - request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy>): - Promise<[ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse - ]>|void { + | protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy + >, + ): Promise< + [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } 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 ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse|null|undefined, - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + | protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse + | null + | undefined, + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listClientTlsPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2252,141 +3245,145 @@ export class NetworkSecurityClient { this._log.info('listClientTlsPolicies request %j', request); return this.innerApiCalls .listClientTlsPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest|null, - protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse - ]) => { - this._log.info('listClientTlsPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[], + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest | null, + protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesResponse, + ]) => { + this._log.info('listClientTlsPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` - * 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. - */ + /** + * Equivalent to `listClientTlsPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy} 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 `listClientTlsPoliciesAsync()` + * 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. + */ listClientTlsPoliciesStream( - request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies stream %j', request); return this.descriptors.page.listClientTlsPolicies.createStream( this.innerApiCalls.listClientTlsPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should - * be listed, specified in the format `projects/* /locations/{location}`. - * @param {number} request.pageSize - * Maximum number of ClientTlsPolicies to return per call. - * @param {string} request.pageToken - * The value returned by the last `ListClientTlsPoliciesResponse` - * Indicates that this is a continuation of a prior - * `ListClientTlsPolicies` call, and that the system - * should return the next page of data. - * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. 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/v1beta1/network_security.list_client_tls_policies.js - * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListClientTlsPolicies_async - */ + /** + * Equivalent to `listClientTlsPolicies`, 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 project and location from which the ClientTlsPolicies should + * be listed, specified in the format `projects/* /locations/{location}`. + * @param {number} request.pageSize + * Maximum number of ClientTlsPolicies to return per call. + * @param {string} request.pageToken + * The value returned by the last `ListClientTlsPoliciesResponse` + * Indicates that this is a continuation of a prior + * `ListClientTlsPolicies` call, and that the system + * should return the next page of data. + * @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.networksecurity.v1beta1.ClientTlsPolicy|ClientTlsPolicy}. 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/v1beta1/network_security.list_client_tls_policies.js + * region_tag:networksecurity_v1beta1_generated_NetworkSecurity_ListClientTlsPolicies_async + */ listClientTlsPoliciesAsync( - request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.networksecurity.v1beta1.IListClientTlsPoliciesRequest, + 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 ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClientTlsPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClientTlsPolicies iterate %j', request); return this.descriptors.page.listClientTlsPolicies.asyncIterate( this.innerApiCalls['listClientTlsPolicies'] as GaxCall, request as {}, - callSettings + 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. - */ + /** + * 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?: @@ -2400,40 +3397,40 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - */ + /** + * 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?: @@ -2447,41 +3444,41 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): 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. - * - */ + /** + * 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?: @@ -2495,12 +3492,12 @@ export class NetworkSecurityClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -2535,12 +3532,11 @@ export class NetworkSecurityClient { | 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. @@ -2573,12 +3569,12 @@ export class NetworkSecurityClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + 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. @@ -2621,22 +3617,22 @@ export class NetworkSecurityClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2671,15 +3667,15 @@ export class NetworkSecurityClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - 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 ?? '', - }); + 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 ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2713,7 +3709,7 @@ export class NetworkSecurityClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2726,25 +3722,24 @@ export class NetworkSecurityClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); 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 @@ -2783,22 +3778,22 @@ export class NetworkSecurityClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.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 ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2814,7 +3809,11 @@ export class NetworkSecurityClient { * @param {string} authorization_policy * @returns {string} Resource name string. */ - authorizationPolicyPath(project:string,location:string,authorizationPolicy:string) { + authorizationPolicyPath( + project: string, + location: string, + authorizationPolicy: string, + ) { return this.pathTemplates.authorizationPolicyPathTemplate.render({ project: project, location: location, @@ -2830,7 +3829,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).project; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).project; } /** @@ -2841,7 +3842,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).location; + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).location; } /** @@ -2851,8 +3854,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing AuthorizationPolicy resource. * @returns {string} A string representing the authorization_policy. */ - matchAuthorizationPolicyFromAuthorizationPolicyName(authorizationPolicyName: string) { - return this.pathTemplates.authorizationPolicyPathTemplate.match(authorizationPolicyName).authorization_policy; + matchAuthorizationPolicyFromAuthorizationPolicyName( + authorizationPolicyName: string, + ) { + return this.pathTemplates.authorizationPolicyPathTemplate.match( + authorizationPolicyName, + ).authorization_policy; } /** @@ -2863,7 +3870,11 @@ export class NetworkSecurityClient { * @param {string} client_tls_policy * @returns {string} Resource name string. */ - clientTlsPolicyPath(project:string,location:string,clientTlsPolicy:string) { + clientTlsPolicyPath( + project: string, + location: string, + clientTlsPolicy: string, + ) { return this.pathTemplates.clientTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2879,7 +3890,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).project; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).project; } /** @@ -2890,7 +3903,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).location; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).location; } /** @@ -2901,7 +3916,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the client_tls_policy. */ matchClientTlsPolicyFromClientTlsPolicyName(clientTlsPolicyName: string) { - return this.pathTemplates.clientTlsPolicyPathTemplate.match(clientTlsPolicyName).client_tls_policy; + return this.pathTemplates.clientTlsPolicyPathTemplate.match( + clientTlsPolicyName, + ).client_tls_policy; } /** @@ -2912,7 +3929,11 @@ export class NetworkSecurityClient { * @param {string} dns_threat_detector * @returns {string} Resource name string. */ - dnsThreatDetectorPath(project:string,location:string,dnsThreatDetector:string) { + dnsThreatDetectorPath( + project: string, + location: string, + dnsThreatDetector: string, + ) { return this.pathTemplates.dnsThreatDetectorPathTemplate.render({ project: project, location: location, @@ -2928,7 +3949,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).project; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).project; } /** @@ -2939,7 +3962,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).location; + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).location; } /** @@ -2949,8 +3974,12 @@ export class NetworkSecurityClient { * A fully-qualified path representing DnsThreatDetector resource. * @returns {string} A string representing the dns_threat_detector. */ - matchDnsThreatDetectorFromDnsThreatDetectorName(dnsThreatDetectorName: string) { - return this.pathTemplates.dnsThreatDetectorPathTemplate.match(dnsThreatDetectorName).dns_threat_detector; + matchDnsThreatDetectorFromDnsThreatDetectorName( + dnsThreatDetectorName: string, + ) { + return this.pathTemplates.dnsThreatDetectorPathTemplate.match( + dnsThreatDetectorName, + ).dns_threat_detector; } /** @@ -2961,7 +3990,11 @@ export class NetworkSecurityClient { * @param {string} server_tls_policy * @returns {string} Resource name string. */ - serverTlsPolicyPath(project:string,location:string,serverTlsPolicy:string) { + serverTlsPolicyPath( + project: string, + location: string, + serverTlsPolicy: string, + ) { return this.pathTemplates.serverTlsPolicyPathTemplate.render({ project: project, location: location, @@ -2977,7 +4010,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the project. */ matchProjectFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).project; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).project; } /** @@ -2988,7 +4023,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the location. */ matchLocationFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).location; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).location; } /** @@ -2999,7 +4036,9 @@ export class NetworkSecurityClient { * @returns {string} A string representing the server_tls_policy. */ matchServerTlsPolicyFromServerTlsPolicyName(serverTlsPolicyName: string) { - return this.pathTemplates.serverTlsPolicyPathTemplate.match(serverTlsPolicyName).server_tls_policy; + return this.pathTemplates.serverTlsPolicyPathTemplate.match( + serverTlsPolicyName, + ).server_tls_policy; } /** @@ -3010,15 +4049,19 @@ export class NetworkSecurityClient { */ close(): Promise { if (this.networkSecurityStub && !this._terminated) { - return this.networkSecurityStub.then(stub => { + return this.networkSecurityStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-networksecurity/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-networksecurity/system-test/fixtures/sample/src/index.ts index a3a21a555210..286413583e0f 100644 --- a/packages/google-cloud-networksecurity/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-networksecurity/system-test/fixtures/sample/src/index.ts @@ -16,10 +16,15 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {DnsThreatDetectorServiceClient, NetworkSecurityClient} from '@google-cloud/network-security'; +import { + DnsThreatDetectorServiceClient, + NetworkSecurityClient, +} from '@google-cloud/network-security'; // check that the client class type name can be used -function doStuffWithDnsThreatDetectorServiceClient(client: DnsThreatDetectorServiceClient) { +function doStuffWithDnsThreatDetectorServiceClient( + client: DnsThreatDetectorServiceClient, +) { client.close(); } function doStuffWithNetworkSecurityClient(client: NetworkSecurityClient) { diff --git a/packages/google-cloud-networksecurity/system-test/install.ts b/packages/google-cloud-networksecurity/system-test/install.ts index f66069aa3940..ccf167042d2e 100644 --- a/packages/google-cloud-networksecurity/system-test/install.ts +++ b/packages/google-cloud-networksecurity/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-networksecurity/test/gapic_address_group_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_address_group_service_v1.ts index 1c7b11ee05e9..7a09c5c34ebe 100644 --- a/packages/google-cloud-networksecurity/test/gapic_address_group_service_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_address_group_service_v1.ts @@ -19,3803 +19,5781 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as addressgroupserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.AddressGroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new addressgroupserviceModule.v1.AddressGroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new addressgroupserviceModule.v1.AddressGroupServiceClient(); + 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 = addressgroupserviceModule.v1.AddressGroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + addressgroupserviceModule.v1.AddressGroupServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + addressgroupserviceModule.v1.AddressGroupServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = addressgroupserviceModule.v1.AddressGroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 addressgroupserviceModule.v1.AddressGroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 addressgroupserviceModule.v1.AddressGroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 addressgroupserviceModule.v1.AddressGroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = addressgroupserviceModule.v1.AddressGroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new addressgroupserviceModule.v1.AddressGroupServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient(); - assert(client); - }); + it('has port', () => { + const port = addressgroupserviceModule.v1.AddressGroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new addressgroupserviceModule.v1.AddressGroupServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.addressGroupServiceStub, undefined); - await client.initialize(); - assert(client.addressGroupServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.addressGroupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.addressGroupServiceStub, undefined); + await client.initialize(); + assert(client.addressGroupServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.addressGroupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.addressGroupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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 close method for the non-initialized client', (done) => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.addressGroupServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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()); }); - describe('getAddressGroup', () => { - it('invokes getAddressGroup without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddressGroup() - ); - client.innerApiCalls.getAddressGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getAddressGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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('getAddressGroup', () => { + it('invokes getAddressGroup without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ); + client.innerApiCalls.getAddressGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getAddressGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAddressGroup without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddressGroup() - ); - client.innerApiCalls.getAddressGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAddressGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAddressGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAddressGroup without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ); + client.innerApiCalls.getAddressGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAddressGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IAddressGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAddressGroup with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAddressGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAddressGroup with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAddressGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAddressGroup with closed client', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAddressGroup(request), expectedError); - }); + it('invokes getAddressGroup with closed client', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAddressGroup(request), expectedError); + }); + }); + + describe('createAddressGroup', () => { + it('invokes createAddressGroup without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAddressGroup', () => { - it('invokes createAddressGroup without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAddressGroup without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAddressGroup with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAddressGroup with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAddressGroupProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateAddressGroupProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateAddressGroupProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAddressGroup', () => { + it('invokes updateAddressGroup without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAddressGroupProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes updateAddressGroup without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateAddressGroup with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAddressGroup', () => { - it('invokes updateAddressGroup without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAddressGroup with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAddressGroup without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateAddressGroupProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateAddressGroup with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateAddressGroupProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addAddressGroupItems', () => { + it('invokes addAddressGroupItems without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAddressGroup with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addAddressGroupItems without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAddressGroupProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes addAddressGroupItems with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.addAddressGroupItems(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAddressGroupProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes addAddressGroupItems with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.addAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkAddAddressGroupItemsProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkAddAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('addAddressGroupItems', () => { - it('invokes addAddressGroupItems without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.addAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAddAddressGroupItemsProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkAddAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeAddressGroupItems', () => { + it('invokes removeAddressGroupItems without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeAddressGroupItems without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeAddressGroupItems with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.removeAddressGroupItems(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeAddressGroupItems with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.removeAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAddAddressGroupItemsProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkAddAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkRemoveAddressGroupItemsProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkRemoveAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkAddAddressGroupItemsProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkRemoveAddressGroupItemsProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRemoveAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cloneAddressGroupItems', () => { + it('invokes cloneAddressGroupItems without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cloneAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cloneAddressGroupItems without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cloneAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeAddressGroupItems', () => { - it('invokes removeAddressGroupItems without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cloneAddressGroupItems with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.cloneAddressGroupItems(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeAddressGroupItems without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cloneAddressGroupItems with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cloneAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeAddressGroupItems with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCloneAddressGroupItemsProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCloneAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes removeAddressGroupItems with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCloneAddressGroupItemsProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCloneAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAddressGroup', () => { + it('invokes deleteAddressGroup without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveAddressGroupItemsProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkRemoveAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteAddressGroup without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveAddressGroupItemsProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteAddressGroup with call error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteAddressGroup with LRO error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cloneAddressGroupItems', () => { - it('invokes cloneAddressGroupItems without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.cloneAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAddressGroupProgress without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes cloneAddressGroupItems without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cloneAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAddressGroupProgress with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAddressGroups', () => { + it('invokes listAddressGroups without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.innerApiCalls.listAddressGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listAddressGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cloneAddressGroupItems with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cloneAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAddressGroups without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.innerApiCalls.listAddressGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAddressGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IAddressGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cloneAddressGroupItems with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cloneAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAddressGroups with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAddressGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAddressGroups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCloneAddressGroupItemsProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCloneAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('invokes listAddressGroupsStream without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.descriptors.page.listAddressGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAddressGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes checkCloneAddressGroupItemsProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCloneAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroups, request), + ); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('deleteAddressGroup', () => { - it('invokes deleteAddressGroup without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAddressGroup without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listAddressGroupsStream with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAddressGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes deleteAddressGroup with call error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroups, request), + ); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes deleteAddressGroup with LRO error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAddressGroups without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.descriptors.page.listAddressGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = + []; + const iterable = client.listAddressGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroups.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkDeleteAddressGroupProgress without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listAddressGroups with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAddressGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroups.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listAddressGroupReferences', () => { + it('invokes listAddressGroupReferences without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.innerApiCalls.listAddressGroupReferences = + stubSimpleCall(expectedResponse); + const [response] = await client.listAddressGroupReferences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAddressGroupProgress with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listAddressGroupReferences without error using callback', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.innerApiCalls.listAddressGroupReferences = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAddressGroupReferences( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAddressGroupReferences with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAddressGroupReferences = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listAddressGroupReferences(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAddressGroups', () => { - it('invokes listAddressGroups without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.innerApiCalls.listAddressGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listAddressGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listAddressGroupReferencesStream without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.descriptors.page.listAddressGroupReferences.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAddressGroupReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listAddressGroups without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.innerApiCalls.listAddressGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAddressGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAddressGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroupReferences, request), + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAddressGroups with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAddressGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAddressGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listAddressGroupReferencesStream with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroupReferences.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAddressGroupReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listAddressGroupsStream without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.descriptors.page.listAddressGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAddressGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { - 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.listAddressGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroups, request)); - assert( - (client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroupReferences, request), + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAddressGroupsStream with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAddressGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroups, request)); - assert( - (client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAddressGroupReferences without error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.descriptors.page.listAddressGroupReferences.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = + []; + const iterable = client.listAddressGroupReferencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listAddressGroups without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.descriptors.page.listAddressGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = []; - const iterable = client.listAddressGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('uses async iteration with listAddressGroupReferences with error', async () => { + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroupReferences.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAddressGroupReferencesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + 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.IOperation[] = []; + 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 addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listAddressGroups with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAddressGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('listAddressGroupReferences', () => { - it('invokes listAddressGroupReferences without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.innerApiCalls.listAddressGroupReferences = stubSimpleCall(expectedResponse); - const [response] = await client.listAddressGroupReferences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAddressGroupReferences without error using callback', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.innerApiCalls.listAddressGroupReferences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAddressGroupReferences( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAddressGroupReferences with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAddressGroupReferences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAddressGroupReferences(request), expectedError); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAddressGroupReferencesStream without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.descriptors.page.listAddressGroupReferences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAddressGroupReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference) => { - 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.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroupReferences, request)); - assert( - (client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAddressGroupReferencesStream with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroupReferences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAddressGroupReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroupReferences, request)); - assert( - (client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listAddressGroupReferences without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.descriptors.page.listAddressGroupReferences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = []; - const iterable = client.listAddressGroupReferencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listAddressGroupReferences with error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroupReferences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAddressGroupReferencesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - 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.IOperation[] = []; - 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 addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - 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('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new addressgroupserviceModule.v1.AddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new addressgroupserviceModule.v1.AddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1.ts index 9cec0bb006d0..c55c9a15990b 100644 --- a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1.ts @@ -19,2725 +19,4241 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as dnsthreatdetectorserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; +import { protobuf, 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(); +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; + 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; + 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]); + 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 stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.DnsThreatDetectorServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); - 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 = dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - await client.initialize(); - assert(client.dnsThreatDetectorServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dnsThreatDetectorServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - 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('getDnsThreatDetector', () => { - it('invokes getDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.getDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - }); - }); - - describe('createDnsThreatDetector', () => { - it('invokes createDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.createDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - }); - }); - - describe('updateDnsThreatDetector', () => { - it('invokes updateDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.updateDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - }); - }); - - describe('deleteDnsThreatDetector', () => { - it('invokes deleteDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - }); - }); - - describe('listDnsThreatDetectors', () => { - it('invokes listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(expectedResponse); - const [response] = await client.listDnsThreatDetectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDnsThreatDetectors without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDnsThreatDetectors( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDnsThreatDetectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDnsThreatDetectorsStream without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.DnsThreatDetector) => { - 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.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); + 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 = + dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient + .servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes listDnsThreatDetectorsStream with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.DnsThreatDetector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('uses async iteration with listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() + 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient( + { universeDomain: 'configured.example.com' }, ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IDnsThreatDetector[] = []; - const iterable = client.listDnsThreatDetectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + await client.initialize(); + assert(client.dnsThreatDetectorServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.dnsThreatDetectorServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + 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('getDnsThreatDetector', () => { + it('invokes getDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.getDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDnsThreatDetectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IDnsThreatDetector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes getDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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!); + }); + + describe('createDnsThreatDetector', () => { + it('invokes createDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.createDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - 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 - ) - ); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('uses async iteration with listLocations with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('updateDnsThreatDetector', () => { + it('invokes updateDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.updateDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('deleteDnsThreatDetector', () => { + it('invokes deleteDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('listDnsThreatDetectors', () => { + it('invokes listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCall(expectedResponse); + const [response] = await client.listDnsThreatDetectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDnsThreatDetectors without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDnsThreatDetectors( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IDnsThreatDetector[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listDnsThreatDetectors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDnsThreatDetectorsStream without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.DnsThreatDetector, + ) => { + 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.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('invokes listDnsThreatDetectorsStream with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.DnsThreatDetector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IDnsThreatDetector[] = + []; + const iterable = client.listDnsThreatDetectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDnsThreatDetectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IDnsThreatDetector[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('Path templates', () => { + describe('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1.DnsThreatDetectorServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1alpha1.ts index 31765f21cdad..d54187561baf 100644 --- a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1alpha1.ts @@ -19,2863 +19,4453 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as dnsthreatdetectorserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; +import { protobuf, 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(); +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; + 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; + 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]); + 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 stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.DnsThreatDetectorServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); - 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 = dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('has universeDomain', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient + .servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has port', () => { - const port = dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with no option', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); - assert(client); + 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - fallback: true, - }); - assert(client); + 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - await client.initialize(); - assert(client.dnsThreatDetectorServiceStub); - }); + it('has port', () => { + const port = + dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dnsThreatDetectorServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient(); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - 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 initialize method and supports deferred initialization', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + await client.initialize(); + assert(client.dnsThreatDetectorServiceStub); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - 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); + it('has close method for the initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.dnsThreatDetectorServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getDnsThreatDetector', () => { - it('invokes getDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.getDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + 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('invokes getDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + 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('getDnsThreatDetector', () => { + it('invokes getDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.getDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - }); + it('invokes getDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDnsThreatDetector', () => { - it('invokes createDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.createDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); + }); + }); + + describe('createDnsThreatDetector', () => { + it('invokes createDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.createDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - }); + it('invokes createDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateDnsThreatDetector', () => { - it('invokes updateDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.updateDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('updateDnsThreatDetector', () => { + it('invokes updateDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.updateDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - }); + it('invokes updateDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('deleteDnsThreatDetector', () => { + it('invokes deleteDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteDnsThreatDetector', () => { - it('invokes deleteDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('listDnsThreatDetectors', () => { + it('invokes listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCall(expectedResponse); + const [response] = await client.listDnsThreatDetectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - }); + it('invokes listDnsThreatDetectors without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDnsThreatDetectors( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDnsThreatDetectors', () => { - it('invokes listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(expectedResponse); - const [response] = await client.listDnsThreatDetectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listDnsThreatDetectors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDnsThreatDetectors without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDnsThreatDetectors( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listDnsThreatDetectorsStream without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDnsThreatDetectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDnsThreatDetectorsStream without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector) => { - 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.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listDnsThreatDetectorsStream with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listDnsThreatDetectorsStream with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[] = []; - const iterable = client.listDnsThreatDetectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[] = + []; + const iterable = client.listDnsThreatDetectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDnsThreatDetectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDnsThreatDetectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IDnsThreatDetector[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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!); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + }, + ); + }); + 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('Path templates', () => { + describe('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1alpha1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1beta1.ts b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1beta1.ts index 51b64ec825d2..eae0a3932ddf 100644 --- a/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1beta1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_dns_threat_detector_service_v1beta1.ts @@ -19,1659 +19,2334 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as dnsthreatdetectorserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; +import { protobuf, 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(); +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; + 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; + 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]); + 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 stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1beta1.DnsThreatDetectorServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); - 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 = dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('has universeDomain', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient + .servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has port', () => { - const port = dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with no option', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); - assert(client); + 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - fallback: true, - }); - assert(client); + 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - await client.initialize(); - assert(client.dnsThreatDetectorServiceStub); - }); + it('has port', () => { + const port = + dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dnsThreatDetectorServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient(); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - 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 initialize method and supports deferred initialization', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + await client.initialize(); + assert(client.dnsThreatDetectorServiceStub); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - 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); + it('has close method for the initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.dnsThreatDetectorServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getDnsThreatDetector', () => { - it('invokes getDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.getDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.dnsThreatDetectorServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + 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('invokes getDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + 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('getDnsThreatDetector', () => { + it('invokes getDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.getDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDnsThreatDetector(request), expectedError); - }); + it('invokes getDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.getDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDnsThreatDetector', () => { - it('invokes createDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.createDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDnsThreatDetector(request), expectedError); + }); + }); + + describe('createDnsThreatDetector', () => { + it('invokes createDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.createDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.createDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDnsThreatDetector(request), expectedError); - }); + it('invokes createDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateDnsThreatDetector', () => { - it('invokes updateDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.updateDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateDnsThreatDetectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('updateDnsThreatDetector', () => { + it('invokes updateDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.updateDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector() - ); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ); + client.innerApiCalls.updateDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedHeaderRequestParams = `dns_threat_detector.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest() - ); - request.dnsThreatDetector ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', ['dnsThreatDetector', 'name']); - request.dnsThreatDetector.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDnsThreatDetector(request), expectedError); - }); + it('invokes updateDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest(), + ); + request.dnsThreatDetector ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateDnsThreatDetectorRequest', + ['dnsThreatDetector', 'name'], + ); + request.dnsThreatDetector.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('deleteDnsThreatDetector', () => { + it('invokes deleteDnsThreatDetector without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteDnsThreatDetector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteDnsThreatDetector', () => { - it('invokes deleteDnsThreatDetector without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDnsThreatDetector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDnsThreatDetector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDnsThreatDetector( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDnsThreatDetector( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDnsThreatDetector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDnsThreatDetector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDnsThreatDetector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDnsThreatDetector with closed client', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteDnsThreatDetector(request), + expectedError, + ); + }); + }); + + describe('listDnsThreatDetectors', () => { + it('invokes listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCall(expectedResponse); + const [response] = await client.listDnsThreatDetectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDnsThreatDetector with closed client', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteDnsThreatDetectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDnsThreatDetector(request), expectedError); - }); + it('invokes listDnsThreatDetectors without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + ]; + client.innerApiCalls.listDnsThreatDetectors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDnsThreatDetectors( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDnsThreatDetectors', () => { - it('invokes listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(expectedResponse); - const [response] = await client.listDnsThreatDetectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listDnsThreatDetectors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDnsThreatDetectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDnsThreatDetectors without error using callback', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - ]; - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDnsThreatDetectors( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listDnsThreatDetectorsStream without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDnsThreatDetectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDnsThreatDetectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDnsThreatDetectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDnsThreatDetectorsStream without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector) => { - 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.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listDnsThreatDetectorsStream with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDnsThreatDetectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listDnsThreatDetectorsStream with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDnsThreatDetectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDnsThreatDetectors, request)); - assert( - (client.descriptors.page.listDnsThreatDetectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDnsThreatDetectors, request), + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDnsThreatDetectors without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector()), - ]; - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[] = []; - const iterable = client.listDnsThreatDetectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDnsThreatDetectors without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DnsThreatDetector(), + ), + ]; + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[] = + []; + const iterable = client.listDnsThreatDetectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDnsThreatDetectors with error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDnsThreatDetectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDnsThreatDetectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDnsThreatDetectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDnsThreatDetectors with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListDnsThreatDetectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDnsThreatDetectors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDnsThreatDetectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1beta1.IDnsThreatDetector[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDnsThreatDetectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDnsThreatDetectors + .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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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!); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + }, + ); + }); + 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('Path templates', () => { + describe('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new dnsthreatdetectorserviceModule.v1beta1.DnsThreatDetectorServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1.ts b/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1.ts index 8b1790d3a66b..dc24ea07c06a 100644 --- a/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1.ts @@ -19,3983 +19,6932 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as firewallactivationModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.FirewallActivationClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient(); + 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 = firewallactivationModule.v1.FirewallActivationClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + firewallactivationModule.v1.FirewallActivationClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + firewallactivationModule.v1.FirewallActivationClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = firewallactivationModule.v1.FirewallActivationClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1.FirewallActivationClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - 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 firewallactivationModule.v1.FirewallActivationClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1.FirewallActivationClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1.FirewallActivationClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = firewallactivationModule.v1.FirewallActivationClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firewallactivationModule.v1.FirewallActivationClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient(); - assert(client); - }); + it('has port', () => { + const port = firewallactivationModule.v1.FirewallActivationClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.firewallActivationStub, undefined); - await client.initialize(); - assert(client.firewallActivationStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.firewallActivationStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firewallActivationStub, undefined); + await client.initialize(); + assert(client.firewallActivationStub); + }); - it('has close method for the non-initialized client', done => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.firewallActivationStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.firewallActivationStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - 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 close method for the non-initialized client', (done) => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firewallActivationStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - 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); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + 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()); }); - describe('getFirewallEndpoint', () => { - it('invokes getFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.FirewallEndpoint() - ); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.getFirewallEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + 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('getFirewallEndpoint', () => { + it('invokes getFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ); + client.innerApiCalls.getFirewallEndpoint = + stubSimpleCall(expectedResponse); + const [response] = await client.getFirewallEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.FirewallEndpoint() - ); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFirewallEndpoint( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IFirewallEndpoint|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ); + client.innerApiCalls.getFirewallEndpoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFirewallEndpoint( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IFirewallEndpoint | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpoint with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFirewallEndpoint with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFirewallEndpoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getFirewallEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpoint with closed client', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFirewallEndpoint(request), expectedError); - }); + it('invokes getFirewallEndpoint with closed client', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getFirewallEndpoint(request), expectedError); + }); + }); + + describe('getProjectFirewallEndpoint', () => { + it('invokes getProjectFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ); + client.innerApiCalls.getProjectFirewallEndpoint = + stubSimpleCall(expectedResponse); + const [response] = await client.getProjectFirewallEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getFirewallEndpointAssociation', () => { - it('invokes getFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation() - ); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getFirewallEndpointAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProjectFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ); + client.innerApiCalls.getProjectFirewallEndpoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProjectFirewallEndpoint( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IFirewallEndpoint | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation() - ); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFirewallEndpointAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProjectFirewallEndpoint with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectFirewallEndpoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getProjectFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpointAssociation with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProjectFirewallEndpoint with closed client', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getProjectFirewallEndpoint(request), + expectedError, + ); + }); + }); + + describe('getFirewallEndpointAssociation', () => { + it('invokes getFirewallEndpointAssociation without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ); + client.innerApiCalls.getFirewallEndpointAssociation = + stubSimpleCall(expectedResponse); + const [response] = await client.getFirewallEndpointAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFirewallEndpointAssociation with closed client', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFirewallEndpointAssociation(request), expectedError); - }); + it('invokes getFirewallEndpointAssociation without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ); + client.innerApiCalls.getFirewallEndpointAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createFirewallEndpoint', () => { - it('invokes createFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFirewallEndpointAssociation with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFirewallEndpointAssociation with closed client', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getFirewallEndpointAssociation(request), + expectedError, + ); + }); + }); + + describe('createFirewallEndpoint', () => { + it('invokes createFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkCreateFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createProjectFirewallEndpoint', () => { + it('invokes createProjectFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProjectFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteFirewallEndpoint', () => { - it('invokes deleteFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createProjectFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProjectFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProjectFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createProjectFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProjectFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createProjectFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createProjectFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProjectFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createProjectFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateProjectFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateProjectFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateProjectFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateProjectFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFirewallEndpoint', () => { + it('invokes deleteFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateFirewallEndpoint', () => { - it('invokes updateFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProjectFirewallEndpoint', () => { + it('invokes deleteProjectFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProjectFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProjectFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProjectFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProjectFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteProjectFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProjectFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteProjectFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteProjectFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProjectFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteProjectFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteProjectFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteProjectFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createFirewallEndpointAssociation', () => { - it('invokes createFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteProjectFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteProjectFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFirewallEndpoint', () => { + it('invokes updateFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateProjectFirewallEndpoint', () => { + it('invokes updateProjectFirewallEndpoint without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProjectFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateProjectFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateProjectFirewallEndpoint without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProjectFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProjectFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteFirewallEndpointAssociation', () => { - it('invokes deleteFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProjectFirewallEndpoint with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateProjectFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProjectFirewallEndpoint with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateProjectFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateProjectFirewallEndpointProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateProjectFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateProjectFirewallEndpointProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateProjectFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createFirewallEndpointAssociation', () => { + it('invokes createFirewallEndpointAssociation without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createFirewallEndpointAssociation without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createFirewallEndpointAssociation with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createFirewallEndpointAssociation with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateFirewallEndpointAssociation', () => { - it('invokes updateFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateFirewallEndpointAssociationProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateFirewallEndpointAssociationProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFirewallEndpointAssociation', () => { + it('invokes deleteFirewallEndpointAssociation without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteFirewallEndpointAssociation without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteFirewallEndpointAssociation with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteFirewallEndpointAssociation with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeleteFirewallEndpointAssociationProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteFirewallEndpointAssociationProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFirewallEndpointAssociation', () => { + it('invokes updateFirewallEndpointAssociation without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listFirewallEndpoints', () => { - it('invokes listFirewallEndpoints without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - ]; - client.innerApiCalls.listFirewallEndpoints = stubSimpleCall(expectedResponse); - const [response] = await client.listFirewallEndpoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpointAssociation without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFirewallEndpoints without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - ]; - client.innerApiCalls.listFirewallEndpoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFirewallEndpoints( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpointAssociation with call error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFirewallEndpoints with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFirewallEndpoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFirewallEndpoints(request), expectedError); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateFirewallEndpointAssociation with LRO error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFirewallEndpointsStream without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - ]; - client.descriptors.page.listFirewallEndpoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFirewallEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.FirewallEndpoint) => { - 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.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpoints, request)); - assert( - (client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes checkUpdateFirewallEndpointAssociationProgress without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes listFirewallEndpointsStream with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFirewallEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.FirewallEndpoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpoints, request)); - assert( - (client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes checkUpdateFirewallEndpointAssociationProgress with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFirewallEndpoints', () => { + it('invokes listFirewallEndpoints without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listFirewallEndpoints = + stubSimpleCall(expectedResponse); + const [response] = await client.listFirewallEndpoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listFirewallEndpoints without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpoint()), - ]; - client.descriptors.page.listFirewallEndpoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = []; - const iterable = client.listFirewallEndpointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listFirewallEndpoints without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listFirewallEndpoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFirewallEndpoints( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listFirewallEndpoints with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFirewallEndpointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listFirewallEndpoints with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFirewallEndpoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listFirewallEndpoints(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listFirewallEndpointAssociations', () => { - it('invokes listFirewallEndpointAssociations without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - ]; - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listFirewallEndpointAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listFirewallEndpointsStream without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listFirewallEndpoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listFirewallEndpointAssociations without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - ]; - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFirewallEndpointAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listFirewallEndpoints, request), + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listFirewallEndpointAssociations with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFirewallEndpointAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listFirewallEndpointsStream with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listFirewallEndpointAssociationsStream without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - ]; - client.descriptors.page.listFirewallEndpointAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFirewallEndpointAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation) => { - 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.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpointAssociations, request)); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listFirewallEndpoints, request), + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listFirewallEndpointAssociationsStream with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpointAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFirewallEndpointAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpointAssociations, request)); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listFirewallEndpoints without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = + []; + const iterable = client.listFirewallEndpointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listFirewallEndpointAssociations without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation()), - ]; - client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[] = []; - const iterable = client.listFirewallEndpointAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('uses async iteration with listFirewallEndpoints with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFirewallEndpointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listProjectFirewallEndpoints', () => { + it('invokes listProjectFirewallEndpoints without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listProjectFirewallEndpoints = + stubSimpleCall(expectedResponse); + const [response] = await client.listProjectFirewallEndpoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listProjectFirewallEndpoints without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listProjectFirewallEndpoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProjectFirewallEndpoints( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listFirewallEndpointAssociations with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFirewallEndpointAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listProjectFirewallEndpoints with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listProjectFirewallEndpoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listProjectFirewallEndpoints(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 listProjectFirewallEndpointsStream without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listProjectFirewallEndpoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProjectFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listProjectFirewallEndpoints, + request, + ), + ); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 listProjectFirewallEndpointsStream with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectFirewallEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProjectFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - it('invokes getLocation with error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listProjectFirewallEndpoints, + request, + ), + ); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + + it('uses async iteration with listProjectFirewallEndpoints without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listProjectFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = + []; + const iterable = client.listProjectFirewallEndpointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProjectFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - 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)); - }); + + it('uses async iteration with listProjectFirewallEndpoints with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProjectFirewallEndpointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProjectFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listProjectFirewallEndpoints + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - 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('listFirewallEndpointAssociations', () => { + it('invokes listFirewallEndpointAssociations without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + ]; + client.innerApiCalls.listFirewallEndpointAssociations = + stubSimpleCall(expectedResponse); + const [response] = await client.listFirewallEndpointAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1.FirewallActivationClient({ - 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 firewallactivationModule.v1.FirewallActivationClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + + it('invokes listFirewallEndpointAssociations without error using callback', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + ]; + client.innerApiCalls.listFirewallEndpointAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFirewallEndpointAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - 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 firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', async () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listFirewallEndpointAssociations with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listFirewallEndpointAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFirewallEndpointAssociationsStream without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + ]; + client.descriptors.page.listFirewallEndpointAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFirewallEndpointAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - describe('organizationLocation', async () => { - const fakePath = "/rendered/path/organizationLocation"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationPath', () => { - const result = client.organizationLocationPath("organizationValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationName', () => { - const result = client.matchOrganizationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationName', () => { - const result = client.matchLocationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listFirewallEndpointAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFirewallEndpointAssociationsStream with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpointAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFirewallEndpointAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listFirewallEndpointAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('uses async iteration with listFirewallEndpointAssociations without error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.FirewallEndpointAssociation(), + ), + ]; + client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[] = + []; + const iterable = client.listFirewallEndpointAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listFirewallEndpointAssociations with error', async () => { + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFirewallEndpointAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IFirewallEndpointAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1.FirewallActivationClient({ + 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 firewallactivationModule.v1.FirewallActivationClient({ + 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.IOperation[] = []; + 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 firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organization', async () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocation', async () => { + const fakePath = '/rendered/path/organizationLocation'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationLocationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationLocationPath', () => { + const result = client.organizationLocationPath( + 'organizationValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationName', () => { + const result = + client.matchOrganizationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationName', () => { + const result = + client.matchLocationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new firewallactivationModule.v1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new firewallactivationModule.v1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1alpha1.ts index 2834abaf37ab..4fdfb699847e 100644 --- a/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_firewall_activation_v1alpha1.ts @@ -19,4121 +19,6020 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as firewallactivationModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.FirewallActivationClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient(); - 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 = firewallactivationModule.v1alpha1.FirewallActivationClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = firewallactivationModule.v1alpha1.FirewallActivationClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1alpha1.FirewallActivationClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1alpha1.FirewallActivationClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1alpha1.FirewallActivationClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has port', () => { - const port = firewallactivationModule.v1alpha1.FirewallActivationClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has universeDomain', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('should create a client with no option', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient(); - assert(client); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + firewallactivationModule.v1alpha1.FirewallActivationClient + .servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + firewallactivationModule.v1alpha1.FirewallActivationClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - fallback: true, - }); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.firewallActivationStub, undefined); - await client.initialize(); - assert(client.firewallActivationStub); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the initialized client', done => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.firewallActivationStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = + firewallactivationModule.v1alpha1.FirewallActivationClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.firewallActivationStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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('should create a client with gRPC fallback', () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + fallback: true, }); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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); + it('has initialize method and supports deferred initialization', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.firewallActivationStub, undefined); + await client.initialize(); + assert(client.firewallActivationStub); }); - describe('getFirewallEndpoint', () => { - it('invokes getFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint() - ); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.getFirewallEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint() - ); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFirewallEndpoint( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpoint with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFirewallEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpoint with closed client', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFirewallEndpoint(request), expectedError); - }); - }); - - describe('getFirewallEndpointAssociation', () => { - it('invokes getFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation() - ); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getFirewallEndpointAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation() - ); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFirewallEndpointAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpointAssociation with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFirewallEndpointAssociation with closed client', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFirewallEndpointAssociation(request), expectedError); - }); - }); - - describe('createFirewallEndpoint', () => { - it('invokes createFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + it('has close method for the initialized client', (done) => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.firewallActivationStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('deleteFirewallEndpoint', () => { - it('invokes deleteFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + it('has close method for the non-initialized client', (done) => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.firewallActivationStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('updateFirewallEndpoint', () => { - it('invokes updateFirewallEndpoint without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFirewallEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpoint without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFirewallEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpoint with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFirewallEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpoint with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest() - ); - request.firewallEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', ['firewallEndpoint', 'name']); - request.firewallEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFirewallEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFirewallEndpointProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateFirewallEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFirewallEndpointProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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()); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFirewallEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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('getFirewallEndpoint', () => { + it('invokes getFirewallEndpoint without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ); + client.innerApiCalls.getFirewallEndpoint = + stubSimpleCall(expectedResponse); + const [response] = await client.getFirewallEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createFirewallEndpointAssociation', () => { - it('invokes createFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes getFirewallEndpoint without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ); + client.innerApiCalls.getFirewallEndpoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFirewallEndpoint( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getFirewallEndpoint with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFirewallEndpoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getFirewallEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteFirewallEndpointAssociation', () => { - it('invokes deleteFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes getFirewallEndpoint with closed client', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getFirewallEndpoint(request), expectedError); + }); + }); + + describe('getFirewallEndpointAssociation', () => { + it('invokes getFirewallEndpointAssociation without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ); + client.innerApiCalls.getFirewallEndpointAssociation = + stubSimpleCall(expectedResponse); + const [response] = await client.getFirewallEndpointAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getFirewallEndpointAssociation without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ); + client.innerApiCalls.getFirewallEndpointAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateFirewallEndpointAssociation', () => { - it('invokes updateFirewallEndpointAssociation without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFirewallEndpointAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpointAssociation without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFirewallEndpointAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpointAssociation with call error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFirewallEndpointAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFirewallEndpointAssociation with LRO error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest() - ); - request.firewallEndpointAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', ['firewallEndpointAssociation', 'name']); - request.firewallEndpointAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFirewallEndpointAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFirewallEndpointAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFirewallEndpointAssociationProgress without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateFirewallEndpointAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFirewallEndpointAssociationProgress with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes getFirewallEndpointAssociation with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFirewallEndpointAssociation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFirewallEndpointAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getFirewallEndpointAssociation with closed client', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getFirewallEndpointAssociation(request), + expectedError, + ); + }); + }); + + describe('createFirewallEndpoint', () => { + it('invokes createFirewallEndpoint without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listFirewallEndpoints', () => { - it('invokes listFirewallEndpoints without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - ]; - client.innerApiCalls.listFirewallEndpoints = stubSimpleCall(expectedResponse); - const [response] = await client.listFirewallEndpoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpoints without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - ]; - client.innerApiCalls.listFirewallEndpoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFirewallEndpoints( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpoints with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFirewallEndpoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFirewallEndpoints(request), expectedError); - const actualRequest = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpointsStream without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - ]; - client.descriptors.page.listFirewallEndpoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFirewallEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint) => { - 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.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpoints, request)); - assert( - (client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFirewallEndpointsStream with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFirewallEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpoints, request)); - assert( - (client.descriptors.page.listFirewallEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFirewallEndpoints without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint()), - ]; - client.descriptors.page.listFirewallEndpoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[] = []; - const iterable = client.listFirewallEndpointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFirewallEndpoints with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFirewallEndpointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFirewallEndpointAssociations', () => { - it('invokes listFirewallEndpointAssociations without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - ]; - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listFirewallEndpointAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpointAssociations without error using callback', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - ]; - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFirewallEndpointAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpointAssociations with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFirewallEndpointAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFirewallEndpointAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFirewallEndpointAssociationsStream without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - ]; - client.descriptors.page.listFirewallEndpointAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFirewallEndpointAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation) => { - 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.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpointAssociations, request)); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFirewallEndpointAssociationsStream with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpointAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFirewallEndpointAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFirewallEndpointAssociations, request)); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFirewallEndpointAssociations without error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation()), - ]; - client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[] = []; - const iterable = client.listFirewallEndpointAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFirewallEndpointAssociations with error', async () => { - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFirewallEndpointAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFirewallEndpointAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFirewallEndpointAssociations.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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes createFirewallEndpoint without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { + it('invokes createFirewallEndpoint with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes createFirewallEndpoint with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkCreateFirewallEndpointProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkCreateFirewallEndpointProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFirewallEndpoint', () => { + it('invokes deleteFirewallEndpoint without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes deleteFirewallEndpoint without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes deleteFirewallEndpoint with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deleteFirewallEndpoint with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkDeleteFirewallEndpointProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes checkDeleteFirewallEndpointProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFirewallEndpoint', () => { + it('invokes updateFirewallEndpoint without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFirewallEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updateFirewallEndpoint without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFirewallEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateFirewallEndpoint with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateFirewallEndpoint(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateFirewallEndpoint with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest(), + ); + request.firewallEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointRequest', + ['firewallEndpoint', 'name'], + ); + request.firewallEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateFirewallEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes checkUpdateFirewallEndpointProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateFirewallEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes checkUpdateFirewallEndpointProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateFirewallEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createFirewallEndpointAssociation', () => { + it('invokes createFirewallEndpointAssociation without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createFirewallEndpointAssociation without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createFirewallEndpointAssociation with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes createFirewallEndpointAssociation with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateFirewallEndpointAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes checkCreateFirewallEndpointAssociationProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkCreateFirewallEndpointAssociationProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFirewallEndpointAssociation', () => { + it('invokes deleteFirewallEndpointAssociation without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deleteFirewallEndpointAssociation without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes deleteFirewallEndpointAssociation with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes deleteFirewallEndpointAssociation with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteFirewallEndpointAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkDeleteFirewallEndpointAssociationProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkDeleteFirewallEndpointAssociationProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFirewallEndpointAssociation', () => { + it('invokes updateFirewallEndpointAssociation without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateFirewallEndpointAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes updateFirewallEndpointAssociation without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFirewallEndpointAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updateFirewallEndpointAssociation with call error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateFirewallEndpointAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateFirewallEndpointAssociation with LRO error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest(), + ); + request.firewallEndpointAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateFirewallEndpointAssociationRequest', + ['firewallEndpointAssociation', 'name'], + ); + request.firewallEndpointAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `firewall_endpoint_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirewallEndpointAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateFirewallEndpointAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFirewallEndpointAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkUpdateFirewallEndpointAssociationProgress without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateFirewallEndpointAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes checkUpdateFirewallEndpointAssociationProgress with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateFirewallEndpointAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFirewallEndpoints', () => { + it('invokes listFirewallEndpoints without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listFirewallEndpoints = + stubSimpleCall(expectedResponse); + const [response] = await client.listFirewallEndpoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listFirewallEndpoints without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + ]; + client.innerApiCalls.listFirewallEndpoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFirewallEndpoints( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFirewallEndpoints with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFirewallEndpoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listFirewallEndpoints(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFirewallEndpointsStream without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listFirewallEndpoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + ) => { + 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.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listFirewallEndpoints, request), + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFirewallEndpointsStream with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFirewallEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listFirewallEndpoints, request), + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listFirewallEndpoints without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpoint(), + ), + ]; + client.descriptors.page.listFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[] = + []; + const iterable = client.listFirewallEndpointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', async () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocation', async () => { - const fakePath = "/rendered/path/organizationLocation"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationPath', () => { - const result = client.organizationLocationPath("organizationValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationName', () => { - const result = client.matchOrganizationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationName', () => { - const result = client.matchLocationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listFirewallEndpoints with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFirewallEndpointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpoints + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listFirewallEndpointAssociations', () => { + it('invokes listFirewallEndpointAssociations without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + ]; + client.innerApiCalls.listFirewallEndpointAssociations = + stubSimpleCall(expectedResponse); + const [response] = await client.listFirewallEndpointAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes listFirewallEndpointAssociations without error using callback', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + ]; + client.innerApiCalls.listFirewallEndpointAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFirewallEndpointAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('invokes listFirewallEndpointAssociations with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFirewallEndpointAssociations = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listFirewallEndpointAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFirewallEndpointAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes listFirewallEndpointAssociationsStream without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + ]; + client.descriptors.page.listFirewallEndpointAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFirewallEndpointAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + ) => { + 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.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listFirewallEndpointAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listFirewallEndpointAssociationsStream with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpointAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFirewallEndpointAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listFirewallEndpointAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listFirewallEndpointAssociations without error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.FirewallEndpointAssociation(), + ), + ]; + client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[] = + []; + const iterable = client.listFirewallEndpointAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listFirewallEndpointAssociations with error', async () => { + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListFirewallEndpointAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFirewallEndpointAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFirewallEndpointAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IFirewallEndpointAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFirewallEndpointAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listFirewallEndpointAssociations + .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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + 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.IOperation[] = []; + 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 firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organization', async () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationLocation', async () => { + const fakePath = '/rendered/path/organizationLocation'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationLocationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationLocationPath', () => { + const result = client.organizationLocationPath( + 'organizationValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationName', () => { + const result = + client.matchOrganizationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationName', () => { + const result = + client.matchLocationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new firewallactivationModule.v1alpha1.FirewallActivationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new firewallactivationModule.v1alpha1.FirewallActivationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_intercept_v1.ts b/packages/google-cloud-networksecurity/test/gapic_intercept_v1.ts index f8c84bca1543..b31a71ab19bb 100644 --- a/packages/google-cloud-networksecurity/test/gapic_intercept_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_intercept_v1.ts @@ -19,5629 +19,8066 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as interceptModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.InterceptClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new interceptModule.v1.InterceptClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new interceptModule.v1.InterceptClient(); - 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 = interceptModule.v1.InterceptClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = interceptModule.v1.InterceptClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new interceptModule.v1.InterceptClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new interceptModule.v1.InterceptClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1.InterceptClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1.InterceptClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1.InterceptClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = interceptModule.v1.InterceptClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new interceptModule.v1.InterceptClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new interceptModule.v1.InterceptClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.interceptStub, undefined); - await client.initialize(); - assert(client.interceptStub); - }); - - it('has close method for the initialized client', done => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.interceptStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.interceptStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new interceptModule.v1.InterceptClient({ - 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 interceptModule.v1.InterceptClient({ - 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('Common methods', () => { + it('has apiEndpoint', () => { + const client = new interceptModule.v1.InterceptClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); }); - describe('getInterceptEndpointGroup', () => { - it('invokes getInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup() - ); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptEndpointGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup() - ); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptEndpointGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup with closed client', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptEndpointGroup(request), expectedError); - }); + it('has universeDomain', () => { + const client = new interceptModule.v1.InterceptClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getInterceptEndpointGroupAssociation', () => { - it('invokes getInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation() - ); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptEndpointGroupAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = interceptModule.v1.InterceptClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = interceptModule.v1.InterceptClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new interceptModule.v1.InterceptClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation() - ); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptEndpointGroupAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new interceptModule.v1.InterceptClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getInterceptEndpointGroupAssociation with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + 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 interceptModule.v1.InterceptClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1.InterceptClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 interceptModule.v1.InterceptClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes getInterceptEndpointGroupAssociation with closed client', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptEndpointGroupAssociation(request), expectedError); - }); + it('has port', () => { + const port = interceptModule.v1.InterceptClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('getInterceptDeploymentGroup', () => { - it('invokes getInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup() - ); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptDeploymentGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new interceptModule.v1.InterceptClient(); + assert(client); + }); - it('invokes getInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup() - ); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptDeploymentGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new interceptModule.v1.InterceptClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getInterceptDeploymentGroup with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.interceptStub, undefined); + await client.initialize(); + assert(client.interceptStub); + }); - it('invokes getInterceptDeploymentGroup with closed client', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptDeploymentGroup(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.interceptStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getInterceptDeployment', () => { - it('invokes getInterceptDeployment without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptDeployment() - ); - client.innerApiCalls.getInterceptDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.interceptStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.InterceptDeployment() - ); - client.innerApiCalls.getInterceptDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new interceptModule.v1.InterceptClient({ + 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('invokes getInterceptDeployment with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new interceptModule.v1.InterceptClient({ + 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('getInterceptEndpointGroup', () => { + it('invokes getInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ); + client.innerApiCalls.getInterceptEndpointGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptEndpointGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getInterceptDeployment with closed client', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptDeployment(request), expectedError); - }); + it('invokes getInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ); + client.innerApiCalls.getInterceptEndpointGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptEndpointGroup', () => { - it('invokes createInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroup with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroup with closed client', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptEndpointGroup(request), + expectedError, + ); + }); + }); + + describe('getInterceptEndpointGroupAssociation', () => { + it('invokes getInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCall(expectedResponse); + const [response] = + await client.getInterceptEndpointGroupAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroupAssociation with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getInterceptEndpointGroupAssociation with closed client', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptEndpointGroupAssociation(request), + expectedError, + ); + }); + }); + + describe('getInterceptDeploymentGroup', () => { + it('invokes getInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ); + client.innerApiCalls.getInterceptDeploymentGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptDeploymentGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ); + client.innerApiCalls.getInterceptDeploymentGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptEndpointGroup', () => { - it('invokes updateInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeploymentGroup with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeploymentGroup with closed client', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptDeploymentGroup(request), + expectedError, + ); + }); + }); + + describe('getInterceptDeployment', () => { + it('invokes getInterceptDeployment without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ); + client.innerApiCalls.getInterceptDeployment = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ); + client.innerApiCalls.getInterceptDeployment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptDeployment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IInterceptDeployment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeployment with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptDeployment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getInterceptDeployment with closed client', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptDeployment(request), + expectedError, + ); + }); + }); + + describe('createInterceptEndpointGroup', () => { + it('invokes createInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptEndpointGroup', () => { - it('invokes deleteInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptEndpointGroup', () => { + it('invokes updateInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptEndpointGroupAssociation', () => { - it('invokes createInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptEndpointGroup', () => { + it('invokes deleteInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptEndpointGroupAssociation', () => { - it('invokes updateInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptEndpointGroupAssociation', () => { + it('invokes createInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteInterceptEndpointGroupAssociation', () => { - it('invokes deleteInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptEndpointGroupAssociation', () => { + it('invokes updateInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptEndpointGroupAssociation', () => { + it('invokes deleteInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptDeploymentGroup', () => { - it('invokes createInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptDeploymentGroup', () => { + it('invokes createInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptDeploymentGroup', () => { - it('invokes updateInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptDeploymentGroup', () => { + it('invokes updateInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptDeploymentGroup', () => { - it('invokes deleteInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptDeploymentGroup', () => { + it('invokes deleteInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptDeployment', () => { - it('invokes createInterceptDeployment without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptDeployment', () => { + it('invokes createInterceptDeployment without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeployment with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeployment with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateInterceptDeployment', () => { - it('invokes updateInterceptDeployment without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptDeployment', () => { + it('invokes updateInterceptDeployment without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptDeployment', () => { + it('invokes deleteInterceptDeployment without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptDeployment', () => { - it('invokes deleteInterceptDeployment without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment with call error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment with call error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listInterceptEndpointGroups', () => { + it('invokes listInterceptEndpointGroups without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptEndpointGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listInterceptEndpointGroups without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptEndpointGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptEndpointGroups', () => { - it('invokes listInterceptEndpointGroups without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - ]; - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptEndpointGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroups with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptEndpointGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptEndpointGroups without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - ]; - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptEndpointGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupsStream without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + ) => { + 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.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroups with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptEndpointGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupsStream with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupsStream without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - ]; - client.descriptors.page.listInterceptEndpointGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup) => { - 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.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroups, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroups without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[] = + []; + const iterable = client.listInterceptEndpointGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupsStream with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroups, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroups with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptEndpointGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptEndpointGroupAssociations', () => { + it('invokes listInterceptEndpointGroupAssociations without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCall(expectedResponse); + const [response] = + await client.listInterceptEndpointGroupAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptEndpointGroups without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroup()), - ]; - client.descriptors.page.listInterceptEndpointGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[] = []; - const iterable = client.listInterceptEndpointGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptEndpointGroupAssociations without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptEndpointGroupAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptEndpointGroups with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptEndpointGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptEndpointGroupAssociations', () => { - it('invokes listInterceptEndpointGroupAssociations without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - ]; - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptEndpointGroupAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociations with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.listInterceptEndpointGroupAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptEndpointGroupAssociations without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - ]; - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptEndpointGroupAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociationsStream without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = + client.listInterceptEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + ) => { + 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.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociations with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptEndpointGroupAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociationsStream with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = + client.listInterceptEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociationsStream without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - ]; - client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation) => { - 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.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroupAssociations without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[] = + []; + const iterable = + client.listInterceptEndpointGroupAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociationsStream with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroupAssociations with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = + client.listInterceptEndpointGroupAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptDeploymentGroups', () => { + it('invokes listInterceptDeploymentGroups without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + ]; + client.innerApiCalls.listInterceptDeploymentGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptDeploymentGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptEndpointGroupAssociations without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptEndpointGroupAssociation()), - ]; - client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[] = []; - const iterable = client.listInterceptEndpointGroupAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptDeploymentGroups without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + ]; + client.innerApiCalls.listInterceptDeploymentGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptDeploymentGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptEndpointGroupAssociations with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptEndpointGroupAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IInterceptEndpointGroupAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptDeploymentGroups', () => { - it('invokes listInterceptDeploymentGroups without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - ]; - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptDeploymentGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroups with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptDeploymentGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptDeploymentGroups without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - ]; - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptDeploymentGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroupsStream without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + ]; + client.descriptors.page.listInterceptDeploymentGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + ) => { + 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.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroups with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptDeploymentGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroupsStream with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeploymentGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroupsStream without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - ]; - client.descriptors.page.listInterceptDeploymentGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup) => { - 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.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeploymentGroups, request)); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeploymentGroups without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup(), + ), + ]; + client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[] = + []; + const iterable = client.listInterceptDeploymentGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroupsStream with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeploymentGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeploymentGroups, request)); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeploymentGroups with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptDeploymentGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptDeployments', () => { + it('invokes listInterceptDeployments without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + ]; + client.innerApiCalls.listInterceptDeployments = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptDeploymentGroups without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeploymentGroup()), - ]; - client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[] = []; - const iterable = client.listInterceptDeploymentGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptDeployments without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + ]; + client.innerApiCalls.listInterceptDeployments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptDeployments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IInterceptDeployment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptDeploymentGroups with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptDeploymentGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IInterceptDeploymentGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptDeployments', () => { - it('invokes listInterceptDeployments without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - ]; - client.innerApiCalls.listInterceptDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInterceptDeployments without error using callback', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - ]; - client.innerApiCalls.listInterceptDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IInterceptDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInterceptDeployments with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeployments with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptDeployments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptDeployments(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptDeploymentsStream without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - ]; - client.descriptors.page.listInterceptDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptDeployment) => { - 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.listInterceptDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeployments, request)); - assert( - (client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listInterceptDeploymentsStream without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + ]; + client.descriptors.page.listInterceptDeployments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptDeployment, + ) => { + 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.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listInterceptDeployments, request), + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentsStream with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.InterceptDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.InterceptDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeployments, request)); - assert( - (client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listInterceptDeploymentsStream with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeployments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.InterceptDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.InterceptDeployment, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listInterceptDeployments, request), + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listInterceptDeployments without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.InterceptDeployment()), - ]; - client.descriptors.page.listInterceptDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IInterceptDeployment[] = []; - const iterable = client.listInterceptDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeployments without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.InterceptDeployment(), + ), + ]; + client.descriptors.page.listInterceptDeployments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IInterceptDeployment[] = + []; + const iterable = client.listInterceptDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listInterceptDeployments with error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IInterceptDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeployments with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeployments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IInterceptDeployment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1.InterceptClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new interceptModule.v1.InterceptClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1.InterceptClient({ + 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1.InterceptClient({ + 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1.InterceptClient({ + 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 interceptModule.v1.InterceptClient({ + 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.IOperation[] = []; + 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 interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('forwardingRule', async () => { + const fakePath = '/rendered/path/forwardingRule'; + const expectedParameters = { + project: 'projectValue', + forwarding_rule: 'forwardingRuleValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.forwardingRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.forwardingRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('forwardingRulePath', () => { + const result = client.forwardingRulePath( + 'projectValue', + 'forwardingRuleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromForwardingRuleName', () => { + const result = client.matchProjectFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchForwardingRuleFromForwardingRuleName', () => { + const result = + client.matchForwardingRuleFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'forwardingRuleValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('forwardingRule', async () => { - const fakePath = "/rendered/path/forwardingRule"; - const expectedParameters = { - project: "projectValue", - forwarding_rule: "forwardingRuleValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.forwardingRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.forwardingRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('forwardingRulePath', () => { - const result = client.forwardingRulePath("projectValue", "forwardingRuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromForwardingRuleName', () => { - const result = client.matchProjectFromForwardingRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchForwardingRuleFromForwardingRuleName', () => { - const result = client.matchForwardingRuleFromForwardingRuleName(fakePath); - assert.strictEqual(result, "forwardingRuleValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new interceptModule.v1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new interceptModule.v1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_intercept_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_intercept_v1alpha1.ts index cd52431371ad..ea4067013f43 100644 --- a/packages/google-cloud-networksecurity/test/gapic_intercept_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_intercept_v1alpha1.ts @@ -19,5767 +19,8127 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as interceptModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.InterceptClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new interceptModule.v1alpha1.InterceptClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new interceptModule.v1alpha1.InterceptClient(); - 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 = interceptModule.v1alpha1.InterceptClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = interceptModule.v1alpha1.InterceptClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new interceptModule.v1alpha1.InterceptClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new interceptModule.v1alpha1.InterceptClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1alpha1.InterceptClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1alpha1.InterceptClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1alpha1.InterceptClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = interceptModule.v1alpha1.InterceptClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new interceptModule.v1alpha1.InterceptClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.interceptStub, undefined); - await client.initialize(); - assert(client.interceptStub); - }); - - it('has close method for the initialized client', done => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.interceptStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.interceptStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new interceptModule.v1alpha1.InterceptClient({ - 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 interceptModule.v1alpha1.InterceptClient({ - 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('Common methods', () => { + it('has apiEndpoint', () => { + const client = new interceptModule.v1alpha1.InterceptClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); }); - describe('getInterceptEndpointGroup', () => { - it('invokes getInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup() - ); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptEndpointGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup() - ); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptEndpointGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInterceptEndpointGroup with closed client', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptEndpointGroup(request), expectedError); - }); + it('has universeDomain', () => { + const client = new interceptModule.v1alpha1.InterceptClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getInterceptEndpointGroupAssociation', () => { - it('invokes getInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation() - ); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptEndpointGroupAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + interceptModule.v1alpha1.InterceptClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + interceptModule.v1alpha1.InterceptClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation() - ); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptEndpointGroupAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getInterceptEndpointGroupAssociation with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptEndpointGroupAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + 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 interceptModule.v1alpha1.InterceptClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 interceptModule.v1alpha1.InterceptClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 interceptModule.v1alpha1.InterceptClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes getInterceptEndpointGroupAssociation with closed client', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptEndpointGroupAssociation(request), expectedError); - }); + it('has port', () => { + const port = interceptModule.v1alpha1.InterceptClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('getInterceptDeploymentGroup', () => { - it('invokes getInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup() - ); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptDeploymentGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new interceptModule.v1alpha1.InterceptClient(); + assert(client); + }); - it('invokes getInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup() - ); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptDeploymentGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getInterceptDeploymentGroup with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.interceptStub, undefined); + await client.initialize(); + assert(client.interceptStub); + }); - it('invokes getInterceptDeploymentGroup with closed client', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptDeploymentGroup(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.interceptStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getInterceptDeployment', () => { - it('invokes getInterceptDeployment without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment() - ); - client.innerApiCalls.getInterceptDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getInterceptDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.interceptStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment() - ); - client.innerApiCalls.getInterceptDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInterceptDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new interceptModule.v1alpha1.InterceptClient({ + 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('invokes getInterceptDeployment with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInterceptDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new interceptModule.v1alpha1.InterceptClient({ + 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('getInterceptEndpointGroup', () => { + it('invokes getInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ); + client.innerApiCalls.getInterceptEndpointGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptEndpointGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getInterceptDeployment with closed client', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInterceptDeployment(request), expectedError); - }); + it('invokes getInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ); + client.innerApiCalls.getInterceptEndpointGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptEndpointGroup', () => { - it('invokes createInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroup with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptEndpointGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroup with closed client', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptEndpointGroup(request), + expectedError, + ); + }); + }); + + describe('getInterceptEndpointGroupAssociation', () => { + it('invokes getInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCall(expectedResponse); + const [response] = + await client.getInterceptEndpointGroupAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptEndpointGroupAssociation with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptEndpointGroupAssociation = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getInterceptEndpointGroupAssociation with closed client', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptEndpointGroupAssociation(request), + expectedError, + ); + }); + }); + + describe('getInterceptDeploymentGroup', () => { + it('invokes getInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ); + client.innerApiCalls.getInterceptDeploymentGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptDeploymentGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ); + client.innerApiCalls.getInterceptDeploymentGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptEndpointGroup', () => { - it('invokes updateInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeploymentGroup with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptDeploymentGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeploymentGroup with closed client', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptDeploymentGroup(request), + expectedError, + ); + }); + }); + + describe('getInterceptDeployment', () => { + it('invokes getInterceptDeployment without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ); + client.innerApiCalls.getInterceptDeployment = + stubSimpleCall(expectedResponse); + const [response] = await client.getInterceptDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ); + client.innerApiCalls.getInterceptDeployment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInterceptDeployment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest() - ); - request.interceptEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', ['interceptEndpointGroup', 'name']); - request.interceptEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInterceptDeployment with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInterceptDeployment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getInterceptDeployment with closed client', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getInterceptDeployment(request), + expectedError, + ); + }); + }); + + describe('createInterceptEndpointGroup', () => { + it('invokes createInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptEndpointGroup', () => { - it('invokes deleteInterceptEndpointGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteInterceptEndpointGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptEndpointGroup', () => { + it('invokes updateInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptEndpointGroupAssociation', () => { - it('invokes createInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest(), + ); + request.interceptEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupRequest', + ['interceptEndpointGroup', 'name'], + ); + request.interceptEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptEndpointGroup', () => { + it('invokes deleteInterceptEndpointGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteInterceptEndpointGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteInterceptEndpointGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptEndpointGroupAssociation', () => { - it('invokes updateInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptEndpointGroupAssociation', () => { + it('invokes createInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest() - ); - request.interceptEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', ['interceptEndpointGroupAssociation', 'name']); - request.interceptEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteInterceptEndpointGroupAssociation', () => { - it('invokes deleteInterceptEndpointGroupAssociation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptEndpointGroupAssociation', () => { + it('invokes updateInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptEndpointGroupAssociation with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest(), + ); + request.interceptEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptEndpointGroupAssociationRequest', + ['interceptEndpointGroupAssociation', 'name'], + ); + request.interceptEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptEndpointGroupAssociationProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteInterceptEndpointGroupAssociationProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptEndpointGroupAssociation', () => { + it('invokes deleteInterceptEndpointGroupAssociation without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteInterceptEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptDeploymentGroup', () => { - it('invokes createInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteInterceptEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptEndpointGroupAssociation with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteInterceptEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteInterceptEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptEndpointGroupAssociationProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteInterceptEndpointGroupAssociationProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptDeploymentGroup', () => { + it('invokes createInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateInterceptDeploymentGroup', () => { - it('invokes updateInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest() - ); - request.interceptDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', ['interceptDeploymentGroup', 'name']); - request.interceptDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptDeploymentGroup', () => { + it('invokes updateInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptDeploymentGroup', () => { - it('invokes deleteInterceptDeploymentGroup without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest(), + ); + request.interceptDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentGroupRequest', + ['interceptDeploymentGroup', 'name'], + ); + request.interceptDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeploymentGroup without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteInterceptDeploymentGroup with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptDeploymentGroup', () => { + it('invokes deleteInterceptDeploymentGroup without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeploymentGroup with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeploymentGroup without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentGroupProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteInterceptDeploymentGroup with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentGroupProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteInterceptDeploymentGroup with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createInterceptDeployment', () => { - it('invokes createInterceptDeployment without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentGroupProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentGroupProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createInterceptDeployment', () => { + it('invokes createInterceptDeployment without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeployment with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createInterceptDeployment with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateInterceptDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateInterceptDeployment', () => { - it('invokes updateInterceptDeployment without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateInterceptDeployment', () => { + it('invokes updateInterceptDeployment without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest() - ); - request.interceptDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', ['interceptDeployment', 'name']); - request.interceptDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest(), + ); + request.interceptDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateInterceptDeploymentRequest', + ['interceptDeployment', 'name'], + ); + request.interceptDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `intercept_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteInterceptDeployment', () => { + it('invokes deleteInterceptDeployment without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInterceptDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteInterceptDeployment', () => { - it('invokes deleteInterceptDeployment without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInterceptDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteInterceptDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInterceptDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInterceptDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment with call error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteInterceptDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment with call error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInterceptDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteInterceptDeployment with LRO error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteInterceptDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInterceptDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteInterceptDeployment with LRO error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteInterceptDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInterceptDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInterceptDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInterceptDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteInterceptDeploymentProgress without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteInterceptDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteInterceptDeploymentProgress without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteInterceptDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteInterceptDeploymentProgress with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteInterceptDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listInterceptEndpointGroups', () => { + it('invokes listInterceptEndpointGroups without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptEndpointGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteInterceptDeploymentProgress with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInterceptDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listInterceptEndpointGroups without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptEndpointGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptEndpointGroups', () => { - it('invokes listInterceptEndpointGroups without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - ]; - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptEndpointGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroups with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptEndpointGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptEndpointGroups without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - ]; - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptEndpointGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupsStream without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + ) => { + 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.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroups with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptEndpointGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptEndpointGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupsStream with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupsStream without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - ]; - client.descriptors.page.listInterceptEndpointGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup) => { - 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.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroups, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroups without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[] = + []; + const iterable = client.listInterceptEndpointGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupsStream with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroups, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroups with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptEndpointGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptEndpointGroupAssociations', () => { + it('invokes listInterceptEndpointGroupAssociations without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCall(expectedResponse); + const [response] = + await client.listInterceptEndpointGroupAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptEndpointGroups without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroup()), - ]; - client.descriptors.page.listInterceptEndpointGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[] = []; - const iterable = client.listInterceptEndpointGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptEndpointGroupAssociations without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptEndpointGroupAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptEndpointGroups with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptEndpointGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptEndpointGroupAssociations', () => { - it('invokes listInterceptEndpointGroupAssociations without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - ]; - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptEndpointGroupAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociations with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptEndpointGroupAssociations = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.listInterceptEndpointGroupAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptEndpointGroupAssociations without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - ]; - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptEndpointGroupAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociationsStream without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = + client.listInterceptEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + ) => { + 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.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociations with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptEndpointGroupAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptEndpointGroupAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptEndpointGroupAssociationsStream with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = + client.listInterceptEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociationsStream without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - ]; - client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation) => { - 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.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroupAssociations without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[] = + []; + const iterable = + client.listInterceptEndpointGroupAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptEndpointGroupAssociationsStream with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroupAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptEndpointGroupAssociations with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = + client.listInterceptEndpointGroupAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptDeploymentGroups', () => { + it('invokes listInterceptDeploymentGroups without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + ]; + client.innerApiCalls.listInterceptDeploymentGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptDeploymentGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptEndpointGroupAssociations without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptEndpointGroupAssociation()), - ]; - client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[] = []; - const iterable = client.listInterceptEndpointGroupAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptDeploymentGroups without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + ]; + client.innerApiCalls.listInterceptDeploymentGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptDeploymentGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptEndpointGroupAssociations with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptEndpointGroupAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptEndpointGroupAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptDeploymentGroups', () => { - it('invokes listInterceptDeploymentGroups without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - ]; - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptDeploymentGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroups with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptDeploymentGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptDeploymentGroups without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - ]; - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptDeploymentGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroupsStream without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + ]; + client.descriptors.page.listInterceptDeploymentGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + ) => { + 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.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroups with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptDeploymentGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptDeploymentGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeploymentGroupsStream with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeploymentGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listInterceptDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroupsStream without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - ]; - client.descriptors.page.listInterceptDeploymentGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup) => { - 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.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeploymentGroups, request)); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeploymentGroups without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup(), + ), + ]; + client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[] = + []; + const iterable = client.listInterceptDeploymentGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentGroupsStream with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeploymentGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeploymentGroups, request)); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeploymentGroups with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptDeploymentGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listInterceptDeployments', () => { + it('invokes listInterceptDeployments without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + ]; + client.innerApiCalls.listInterceptDeployments = + stubSimpleCall(expectedResponse); + const [response] = await client.listInterceptDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInterceptDeploymentGroups without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeploymentGroup()), - ]; - client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[] = []; - const iterable = client.listInterceptDeploymentGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInterceptDeployments without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + ]; + client.innerApiCalls.listInterceptDeployments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInterceptDeployments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInterceptDeploymentGroups with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeploymentGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptDeploymentGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeploymentGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInterceptDeployments', () => { - it('invokes listInterceptDeployments without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - ]; - client.innerApiCalls.listInterceptDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listInterceptDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInterceptDeployments without error using callback', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - ]; - client.innerApiCalls.listInterceptDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInterceptDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInterceptDeployments with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInterceptDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInterceptDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInterceptDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInterceptDeployments with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInterceptDeployments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listInterceptDeployments(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInterceptDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInterceptDeploymentsStream without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - ]; - client.descriptors.page.listInterceptDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInterceptDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment) => { - 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.listInterceptDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeployments, request)); - assert( - (client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listInterceptDeploymentsStream without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + ]; + client.descriptors.page.listInterceptDeployments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInterceptDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + ) => { + 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.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listInterceptDeployments, request), + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listInterceptDeploymentsStream with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInterceptDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInterceptDeployments, request)); - assert( - (client.descriptors.page.listInterceptDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listInterceptDeploymentsStream with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeployments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInterceptDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listInterceptDeployments, request), + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listInterceptDeployments without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment()), - ]; - client.descriptors.page.listInterceptDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[] = []; - const iterable = client.listInterceptDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeployments without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.InterceptDeployment(), + ), + ]; + client.descriptors.page.listInterceptDeployments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[] = + []; + const iterable = client.listInterceptDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listInterceptDeployments with error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInterceptDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInterceptDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInterceptDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInterceptDeployments with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListInterceptDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInterceptDeployments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInterceptDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IInterceptDeployment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInterceptDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listInterceptDeployments + .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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 interceptModule.v1alpha1.InterceptClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 interceptModule.v1alpha1.InterceptClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new interceptModule.v1alpha1.InterceptClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1alpha1.InterceptClient({ + 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1alpha1.InterceptClient({ + 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 interceptModule.v1alpha1.InterceptClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 interceptModule.v1alpha1.InterceptClient({ + 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 interceptModule.v1alpha1.InterceptClient({ + 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.IOperation[] = []; + 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 interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('forwardingRule', async () => { - const fakePath = "/rendered/path/forwardingRule"; - const expectedParameters = { - project: "projectValue", - forwarding_rule: "forwardingRuleValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.forwardingRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.forwardingRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('forwardingRulePath', () => { - const result = client.forwardingRulePath("projectValue", "forwardingRuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromForwardingRuleName', () => { - const result = client.matchProjectFromForwardingRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchForwardingRuleFromForwardingRuleName', () => { - const result = client.matchForwardingRuleFromForwardingRuleName(fakePath); - assert.strictEqual(result, "forwardingRuleValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('forwardingRule', async () => { + const fakePath = '/rendered/path/forwardingRule'; + const expectedParameters = { + project: 'projectValue', + forwarding_rule: 'forwardingRuleValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.forwardingRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.forwardingRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('forwardingRulePath', () => { + const result = client.forwardingRulePath( + 'projectValue', + 'forwardingRuleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromForwardingRuleName', () => { + const result = client.matchProjectFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchForwardingRuleFromForwardingRuleName', () => { + const result = + client.matchForwardingRuleFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'forwardingRuleValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new interceptModule.v1alpha1.InterceptClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new interceptModule.v1alpha1.InterceptClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_mirroring_v1.ts b/packages/google-cloud-networksecurity/test/gapic_mirroring_v1.ts index a6a7c9103037..d785bd88756b 100644 --- a/packages/google-cloud-networksecurity/test/gapic_mirroring_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_mirroring_v1.ts @@ -19,5629 +19,8066 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as mirroringModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.MirroringClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new mirroringModule.v1.MirroringClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new mirroringModule.v1.MirroringClient(); - 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 = mirroringModule.v1.MirroringClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = mirroringModule.v1.MirroringClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new mirroringModule.v1.MirroringClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new mirroringModule.v1.MirroringClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1.MirroringClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1.MirroringClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1.MirroringClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = mirroringModule.v1.MirroringClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new mirroringModule.v1.MirroringClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new mirroringModule.v1.MirroringClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mirroringStub, undefined); - await client.initialize(); - assert(client.mirroringStub); - }); - - it('has close method for the initialized client', done => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.mirroringStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mirroringStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new mirroringModule.v1.MirroringClient({ - 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 mirroringModule.v1.MirroringClient({ - 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('Common methods', () => { + it('has apiEndpoint', () => { + const client = new mirroringModule.v1.MirroringClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); }); - describe('getMirroringEndpointGroup', () => { - it('invokes getMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup() - ); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringEndpointGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup() - ); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringEndpointGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup with closed client', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringEndpointGroup(request), expectedError); - }); + it('has universeDomain', () => { + const client = new mirroringModule.v1.MirroringClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getMirroringEndpointGroupAssociation', () => { - it('invokes getMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation() - ); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringEndpointGroupAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = mirroringModule.v1.MirroringClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = mirroringModule.v1.MirroringClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new mirroringModule.v1.MirroringClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation() - ); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringEndpointGroupAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new mirroringModule.v1.MirroringClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getMirroringEndpointGroupAssociation with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + 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 mirroringModule.v1.MirroringClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1.MirroringClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 mirroringModule.v1.MirroringClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes getMirroringEndpointGroupAssociation with closed client', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringEndpointGroupAssociation(request), expectedError); - }); + it('has port', () => { + const port = mirroringModule.v1.MirroringClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('getMirroringDeploymentGroup', () => { - it('invokes getMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup() - ); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringDeploymentGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new mirroringModule.v1.MirroringClient(); + assert(client); + }); - it('invokes getMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup() - ); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringDeploymentGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new mirroringModule.v1.MirroringClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getMirroringDeploymentGroup with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.mirroringStub, undefined); + await client.initialize(); + assert(client.mirroringStub); + }); - it('invokes getMirroringDeploymentGroup with closed client', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringDeploymentGroup(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.mirroringStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getMirroringDeployment', () => { - it('invokes getMirroringDeployment without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringDeployment() - ); - client.innerApiCalls.getMirroringDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.mirroringStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.MirroringDeployment() - ); - client.innerApiCalls.getMirroringDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mirroringModule.v1.MirroringClient({ + 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('invokes getMirroringDeployment with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mirroringModule.v1.MirroringClient({ + 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('getMirroringEndpointGroup', () => { + it('invokes getMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ); + client.innerApiCalls.getMirroringEndpointGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringEndpointGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMirroringDeployment with closed client', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringDeployment(request), expectedError); - }); + it('invokes getMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ); + client.innerApiCalls.getMirroringEndpointGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringEndpointGroup', () => { - it('invokes createMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroup with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroup with closed client', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringEndpointGroup(request), + expectedError, + ); + }); + }); + + describe('getMirroringEndpointGroupAssociation', () => { + it('invokes getMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCall(expectedResponse); + const [response] = + await client.getMirroringEndpointGroupAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroupAssociation with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getMirroringEndpointGroupAssociation with closed client', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringEndpointGroupAssociation(request), + expectedError, + ); + }); + }); + + describe('getMirroringDeploymentGroup', () => { + it('invokes getMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ); + client.innerApiCalls.getMirroringDeploymentGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringDeploymentGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ); + client.innerApiCalls.getMirroringDeploymentGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringEndpointGroup', () => { - it('invokes updateMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeploymentGroup with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeploymentGroup with closed client', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringDeploymentGroup(request), + expectedError, + ); + }); + }); + + describe('getMirroringDeployment', () => { + it('invokes getMirroringDeployment without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ); + client.innerApiCalls.getMirroringDeployment = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ); + client.innerApiCalls.getMirroringDeployment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringDeployment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IMirroringDeployment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeployment with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringDeployment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getMirroringDeployment with closed client', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringDeployment(request), + expectedError, + ); + }); + }); + + describe('createMirroringEndpointGroup', () => { + it('invokes createMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringEndpointGroup', () => { - it('invokes deleteMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringEndpointGroup', () => { + it('invokes updateMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringEndpointGroupAssociation', () => { - it('invokes createMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringEndpointGroup', () => { + it('invokes deleteMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringEndpointGroupAssociation', () => { - it('invokes updateMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringEndpointGroupAssociation', () => { + it('invokes createMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteMirroringEndpointGroupAssociation', () => { - it('invokes deleteMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringEndpointGroupAssociation', () => { + it('invokes updateMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringEndpointGroupAssociation', () => { + it('invokes deleteMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringDeploymentGroup', () => { - it('invokes createMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringDeploymentGroup', () => { + it('invokes createMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringDeploymentGroup', () => { - it('invokes updateMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringDeploymentGroup', () => { + it('invokes updateMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringDeploymentGroup', () => { - it('invokes deleteMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringDeploymentGroup', () => { + it('invokes deleteMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringDeployment', () => { - it('invokes createMirroringDeployment without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringDeployment', () => { + it('invokes createMirroringDeployment without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateMirroringDeployment', () => { - it('invokes updateMirroringDeployment without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringDeployment', () => { + it('invokes updateMirroringDeployment without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringDeployment', () => { + it('invokes deleteMirroringDeployment without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringDeployment', () => { - it('invokes deleteMirroringDeployment without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listMirroringEndpointGroups', () => { + it('invokes listMirroringEndpointGroups without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringEndpointGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listMirroringEndpointGroups without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringEndpointGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringEndpointGroups', () => { - it('invokes listMirroringEndpointGroups without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - ]; - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringEndpointGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroups with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringEndpointGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringEndpointGroups without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - ]; - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringEndpointGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupsStream without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + ) => { + 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.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroups with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringEndpointGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupsStream with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupsStream without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - ]; - client.descriptors.page.listMirroringEndpointGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup) => { - 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.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroups, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroups without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[] = + []; + const iterable = client.listMirroringEndpointGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupsStream with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroups, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroups with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringEndpointGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringEndpointGroupAssociations', () => { + it('invokes listMirroringEndpointGroupAssociations without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCall(expectedResponse); + const [response] = + await client.listMirroringEndpointGroupAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringEndpointGroups without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroup()), - ]; - client.descriptors.page.listMirroringEndpointGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[] = []; - const iterable = client.listMirroringEndpointGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringEndpointGroupAssociations without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringEndpointGroupAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringEndpointGroups with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringEndpointGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringEndpointGroupAssociations', () => { - it('invokes listMirroringEndpointGroupAssociations without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - ]; - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringEndpointGroupAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociations with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.listMirroringEndpointGroupAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringEndpointGroupAssociations without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - ]; - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringEndpointGroupAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociationsStream without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = + client.listMirroringEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + ) => { + 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.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociations with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringEndpointGroupAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociationsStream with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = + client.listMirroringEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociationsStream without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - ]; - client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation) => { - 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.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroupAssociations without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[] = + []; + const iterable = + client.listMirroringEndpointGroupAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociationsStream with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroupAssociations with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = + client.listMirroringEndpointGroupAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringDeploymentGroups', () => { + it('invokes listMirroringDeploymentGroups without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + ]; + client.innerApiCalls.listMirroringDeploymentGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringDeploymentGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringEndpointGroupAssociations without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringEndpointGroupAssociation()), - ]; - client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[] = []; - const iterable = client.listMirroringEndpointGroupAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringDeploymentGroups without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + ]; + client.innerApiCalls.listMirroringDeploymentGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringDeploymentGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringEndpointGroupAssociations with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringEndpointGroupAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IMirroringEndpointGroupAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringDeploymentGroups', () => { - it('invokes listMirroringDeploymentGroups without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - ]; - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringDeploymentGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroups with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringDeploymentGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringDeploymentGroups without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - ]; - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringDeploymentGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroupsStream without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + ]; + client.descriptors.page.listMirroringDeploymentGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + ) => { + 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.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroups with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringDeploymentGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroupsStream with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeploymentGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroupsStream without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - ]; - client.descriptors.page.listMirroringDeploymentGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup) => { - 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.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeploymentGroups, request)); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeploymentGroups without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup(), + ), + ]; + client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[] = + []; + const iterable = client.listMirroringDeploymentGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroupsStream with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeploymentGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeploymentGroups, request)); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeploymentGroups with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringDeploymentGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringDeployments', () => { + it('invokes listMirroringDeployments without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + ]; + client.innerApiCalls.listMirroringDeployments = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringDeploymentGroups without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeploymentGroup()), - ]; - client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[] = []; - const iterable = client.listMirroringDeploymentGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringDeployments without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + ]; + client.innerApiCalls.listMirroringDeployments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringDeployments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IMirroringDeployment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringDeploymentGroups with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringDeploymentGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IMirroringDeploymentGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringDeployments', () => { - it('invokes listMirroringDeployments without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - ]; - client.innerApiCalls.listMirroringDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMirroringDeployments without error using callback', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - ]; - client.innerApiCalls.listMirroringDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IMirroringDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMirroringDeployments with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeployments with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringDeployments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringDeployments(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringDeploymentsStream without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - ]; - client.descriptors.page.listMirroringDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringDeployment) => { - 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.listMirroringDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeployments, request)); - assert( - (client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listMirroringDeploymentsStream without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + ]; + client.descriptors.page.listMirroringDeployments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringDeployment, + ) => { + 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.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMirroringDeployments, request), + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentsStream with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.MirroringDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.MirroringDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeployments, request)); - assert( - (client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listMirroringDeploymentsStream with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeployments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.MirroringDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.MirroringDeployment, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMirroringDeployments, request), + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listMirroringDeployments without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.MirroringDeployment()), - ]; - client.descriptors.page.listMirroringDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IMirroringDeployment[] = []; - const iterable = client.listMirroringDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeployments without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.MirroringDeployment(), + ), + ]; + client.descriptors.page.listMirroringDeployments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IMirroringDeployment[] = + []; + const iterable = client.listMirroringDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listMirroringDeployments with error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IMirroringDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeployments with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeployments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IMirroringDeployment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1.MirroringClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new mirroringModule.v1.MirroringClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1.MirroringClient({ + 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1.MirroringClient({ + 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1.MirroringClient({ + 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 mirroringModule.v1.MirroringClient({ + 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.IOperation[] = []; + 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 mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('forwardingRule', async () => { + const fakePath = '/rendered/path/forwardingRule'; + const expectedParameters = { + project: 'projectValue', + forwarding_rule: 'forwardingRuleValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.forwardingRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.forwardingRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('forwardingRulePath', () => { + const result = client.forwardingRulePath( + 'projectValue', + 'forwardingRuleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromForwardingRuleName', () => { + const result = client.matchProjectFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchForwardingRuleFromForwardingRuleName', () => { + const result = + client.matchForwardingRuleFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'forwardingRuleValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('forwardingRule', async () => { - const fakePath = "/rendered/path/forwardingRule"; - const expectedParameters = { - project: "projectValue", - forwarding_rule: "forwardingRuleValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.forwardingRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.forwardingRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('forwardingRulePath', () => { - const result = client.forwardingRulePath("projectValue", "forwardingRuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromForwardingRuleName', () => { - const result = client.matchProjectFromForwardingRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchForwardingRuleFromForwardingRuleName', () => { - const result = client.matchForwardingRuleFromForwardingRuleName(fakePath); - assert.strictEqual(result, "forwardingRuleValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new mirroringModule.v1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new mirroringModule.v1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_mirroring_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_mirroring_v1alpha1.ts index 1bf993d8851b..bf51b5437834 100644 --- a/packages/google-cloud-networksecurity/test/gapic_mirroring_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_mirroring_v1alpha1.ts @@ -19,5767 +19,8127 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as mirroringModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.MirroringClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new mirroringModule.v1alpha1.MirroringClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new mirroringModule.v1alpha1.MirroringClient(); - 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 = mirroringModule.v1alpha1.MirroringClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = mirroringModule.v1alpha1.MirroringClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new mirroringModule.v1alpha1.MirroringClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new mirroringModule.v1alpha1.MirroringClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1alpha1.MirroringClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1alpha1.MirroringClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1alpha1.MirroringClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = mirroringModule.v1alpha1.MirroringClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new mirroringModule.v1alpha1.MirroringClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mirroringStub, undefined); - await client.initialize(); - assert(client.mirroringStub); - }); - - it('has close method for the initialized client', done => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.mirroringStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.mirroringStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new mirroringModule.v1alpha1.MirroringClient({ - 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 mirroringModule.v1alpha1.MirroringClient({ - 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('Common methods', () => { + it('has apiEndpoint', () => { + const client = new mirroringModule.v1alpha1.MirroringClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); }); - describe('getMirroringEndpointGroup', () => { - it('invokes getMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup() - ); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringEndpointGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup() - ); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringEndpointGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMirroringEndpointGroup with closed client', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringEndpointGroup(request), expectedError); - }); + it('has universeDomain', () => { + const client = new mirroringModule.v1alpha1.MirroringClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getMirroringEndpointGroupAssociation', () => { - it('invokes getMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation() - ); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringEndpointGroupAssociation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + mirroringModule.v1alpha1.MirroringClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + mirroringModule.v1alpha1.MirroringClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation() - ); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringEndpointGroupAssociation( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getMirroringEndpointGroupAssociation with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringEndpointGroupAssociation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + 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 mirroringModule.v1alpha1.MirroringClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 mirroringModule.v1alpha1.MirroringClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 mirroringModule.v1alpha1.MirroringClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes getMirroringEndpointGroupAssociation with closed client', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringEndpointGroupAssociation(request), expectedError); - }); + it('has port', () => { + const port = mirroringModule.v1alpha1.MirroringClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('getMirroringDeploymentGroup', () => { - it('invokes getMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup() - ); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringDeploymentGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new mirroringModule.v1alpha1.MirroringClient(); + assert(client); + }); - it('invokes getMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup() - ); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringDeploymentGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getMirroringDeploymentGroup with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.mirroringStub, undefined); + await client.initialize(); + assert(client.mirroringStub); + }); - it('invokes getMirroringDeploymentGroup with closed client', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringDeploymentGroup(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.mirroringStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getMirroringDeployment', () => { - it('invokes getMirroringDeployment without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment() - ); - client.innerApiCalls.getMirroringDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getMirroringDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.mirroringStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment() - ); - client.innerApiCalls.getMirroringDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMirroringDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mirroringModule.v1alpha1.MirroringClient({ + 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('invokes getMirroringDeployment with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMirroringDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new mirroringModule.v1alpha1.MirroringClient({ + 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('getMirroringEndpointGroup', () => { + it('invokes getMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ); + client.innerApiCalls.getMirroringEndpointGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringEndpointGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMirroringDeployment with closed client', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMirroringDeployment(request), expectedError); - }); + it('invokes getMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ); + client.innerApiCalls.getMirroringEndpointGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringEndpointGroup', () => { - it('invokes createMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroup with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringEndpointGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroup with closed client', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringEndpointGroup(request), + expectedError, + ); + }); + }); + + describe('getMirroringEndpointGroupAssociation', () => { + it('invokes getMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCall(expectedResponse); + const [response] = + await client.getMirroringEndpointGroupAssociation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringEndpointGroupAssociation with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringEndpointGroupAssociation = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getMirroringEndpointGroupAssociation with closed client', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringEndpointGroupAssociation(request), + expectedError, + ); + }); + }); + + describe('getMirroringDeploymentGroup', () => { + it('invokes getMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ); + client.innerApiCalls.getMirroringDeploymentGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringDeploymentGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ); + client.innerApiCalls.getMirroringDeploymentGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringEndpointGroup', () => { - it('invokes updateMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeploymentGroup with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringDeploymentGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeploymentGroup with closed client', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringDeploymentGroup(request), + expectedError, + ); + }); + }); + + describe('getMirroringDeployment', () => { + it('invokes getMirroringDeployment without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ); + client.innerApiCalls.getMirroringDeployment = + stubSimpleCall(expectedResponse); + const [response] = await client.getMirroringDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ); + client.innerApiCalls.getMirroringDeployment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMirroringDeployment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest() - ); - request.mirroringEndpointGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', ['mirroringEndpointGroup', 'name']); - request.mirroringEndpointGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMirroringDeployment with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMirroringDeployment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getMirroringDeployment with closed client', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMirroringDeployment(request), + expectedError, + ); + }); + }); + + describe('createMirroringEndpointGroup', () => { + it('invokes createMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringEndpointGroup', () => { - it('invokes deleteMirroringEndpointGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringEndpointGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringEndpointGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringEndpointGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteMirroringEndpointGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringEndpointGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringEndpointGroup', () => { + it('invokes updateMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringEndpointGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringEndpointGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringEndpointGroupAssociation', () => { - it('invokes createMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest(), + ); + request.mirroringEndpointGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupRequest', + ['mirroringEndpointGroup', 'name'], + ); + request.mirroringEndpointGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringEndpointGroup', () => { + it('invokes deleteMirroringEndpointGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringEndpointGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringEndpointGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteMirroringEndpointGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringEndpointGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteMirroringEndpointGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringEndpointGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringEndpointGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringEndpointGroupAssociation', () => { - it('invokes updateMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringEndpointGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringEndpointGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringEndpointGroupAssociation', () => { + it('invokes createMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest() - ); - request.mirroringEndpointGroupAssociation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', ['mirroringEndpointGroupAssociation', 'name']); - request.mirroringEndpointGroupAssociation.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringEndpointGroupAssociationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .createMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteMirroringEndpointGroupAssociation', () => { - it('invokes deleteMirroringEndpointGroupAssociation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringEndpointGroupAssociation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringEndpointGroupAssociation', () => { + it('invokes updateMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringEndpointGroupAssociation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringEndpointGroupAssociation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringEndpointGroupAssociation with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringEndpointGroupAssociation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringEndpointGroupAssociation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringEndpointGroupAssociation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest(), + ); + request.mirroringEndpointGroupAssociation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringEndpointGroupAssociationRequest', + ['mirroringEndpointGroupAssociation', 'name'], + ); + request.mirroringEndpointGroupAssociation.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_endpoint_group_association.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .updateMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringEndpointGroupAssociationProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringEndpointGroupAssociationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteMirroringEndpointGroupAssociationProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringEndpointGroupAssociationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringEndpointGroupAssociation', () => { + it('invokes deleteMirroringEndpointGroupAssociation without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteMirroringEndpointGroupAssociation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringDeploymentGroup', () => { - it('invokes createMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringEndpointGroupAssociation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteMirroringEndpointGroupAssociation(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringEndpointGroupAssociation with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringEndpointGroupAssociationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringEndpointGroupAssociation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteMirroringEndpointGroupAssociation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .deleteMirroringEndpointGroupAssociation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringEndpointGroupAssociationProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringEndpointGroupAssociationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteMirroringEndpointGroupAssociationProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringEndpointGroupAssociationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringDeploymentGroup', () => { + it('invokes createMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMirroringDeploymentGroup', () => { - it('invokes updateMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest() - ); - request.mirroringDeploymentGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', ['mirroringDeploymentGroup', 'name']); - request.mirroringDeploymentGroup.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringDeploymentGroup', () => { + it('invokes updateMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringDeploymentGroup', () => { - it('invokes deleteMirroringDeploymentGroup without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringDeploymentGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest(), + ); + request.mirroringDeploymentGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentGroupRequest', + ['mirroringDeploymentGroup', 'name'], + ); + request.mirroringDeploymentGroup.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeploymentGroup without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringDeploymentGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteMirroringDeploymentGroup with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringDeploymentGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringDeploymentGroup', () => { + it('invokes deleteMirroringDeploymentGroup without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeploymentGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringDeploymentGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeploymentGroup with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringDeploymentGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeploymentGroup without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeploymentGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringDeploymentGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentGroupProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringDeploymentGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteMirroringDeploymentGroup with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringDeploymentGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentGroupProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringDeploymentGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteMirroringDeploymentGroup with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeploymentGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringDeploymentGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeploymentGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMirroringDeployment', () => { - it('invokes createMirroringDeployment without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentGroupProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringDeploymentGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentGroupProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringDeploymentGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMirroringDeployment', () => { + it('invokes createMirroringDeployment without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateMirroringDeploymentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateMirroringDeployment', () => { - it('invokes updateMirroringDeployment without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMirroringDeployment', () => { + it('invokes updateMirroringDeployment without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest() - ); - request.mirroringDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', ['mirroringDeployment', 'name']); - request.mirroringDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest(), + ); + request.mirroringDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateMirroringDeploymentRequest', + ['mirroringDeployment', 'name'], + ); + request.mirroringDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `mirroring_deployment.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMirroringDeployment', () => { + it('invokes deleteMirroringDeployment without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeployment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMirroringDeployment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMirroringDeployment', () => { - it('invokes deleteMirroringDeployment without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMirroringDeployment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMirroringDeployment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMirroringDeployment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMirroringDeployment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment with call error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMirroringDeployment(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment with call error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMirroringDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMirroringDeployment with LRO error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMirroringDeployment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMirroringDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMirroringDeployment with LRO error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteMirroringDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMirroringDeployment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMirroringDeployment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMirroringDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteMirroringDeploymentProgress without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteMirroringDeploymentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteMirroringDeploymentProgress without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteMirroringDeploymentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteMirroringDeploymentProgress with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMirroringDeploymentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listMirroringEndpointGroups', () => { + it('invokes listMirroringEndpointGroups without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringEndpointGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMirroringDeploymentProgress with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMirroringDeploymentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listMirroringEndpointGroups without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringEndpointGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringEndpointGroups', () => { - it('invokes listMirroringEndpointGroups without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - ]; - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringEndpointGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroups with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringEndpointGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringEndpointGroups without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - ]; - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringEndpointGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupsStream without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + ) => { + 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.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroups with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringEndpointGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringEndpointGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupsStream with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringEndpointGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupsStream without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - ]; - client.descriptors.page.listMirroringEndpointGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup) => { - 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.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroups, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroups without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[] = + []; + const iterable = client.listMirroringEndpointGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupsStream with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringEndpointGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroups, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroups with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringEndpointGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringEndpointGroupAssociations', () => { + it('invokes listMirroringEndpointGroupAssociations without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCall(expectedResponse); + const [response] = + await client.listMirroringEndpointGroupAssociations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringEndpointGroups without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroup()), - ]; - client.descriptors.page.listMirroringEndpointGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[] = []; - const iterable = client.listMirroringEndpointGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringEndpointGroupAssociations without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + ]; + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringEndpointGroupAssociations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringEndpointGroups with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringEndpointGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringEndpointGroupAssociations', () => { - it('invokes listMirroringEndpointGroupAssociations without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - ]; - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringEndpointGroupAssociations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociations with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringEndpointGroupAssociations = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.listMirroringEndpointGroupAssociations(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringEndpointGroupAssociations without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - ]; - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringEndpointGroupAssociations( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociationsStream without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = + client.listMirroringEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + ) => { + 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.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociations with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringEndpointGroupAssociations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringEndpointGroupAssociations(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringEndpointGroupAssociations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringEndpointGroupAssociationsStream with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = + client.listMirroringEndpointGroupAssociationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringEndpointGroupAssociations, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociationsStream without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - ]; - client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation) => { - 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.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroupAssociations without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation(), + ), + ]; + client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[] = + []; + const iterable = + client.listMirroringEndpointGroupAssociationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringEndpointGroupAssociationsStream with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroupAssociations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringEndpointGroupAssociationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringEndpointGroupAssociations, request)); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringEndpointGroupAssociations with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = + client.listMirroringEndpointGroupAssociationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringEndpointGroupAssociations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringDeploymentGroups', () => { + it('invokes listMirroringDeploymentGroups without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + ]; + client.innerApiCalls.listMirroringDeploymentGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringDeploymentGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringEndpointGroupAssociations without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringEndpointGroupAssociation()), - ]; - client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[] = []; - const iterable = client.listMirroringEndpointGroupAssociationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringDeploymentGroups without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + ]; + client.innerApiCalls.listMirroringDeploymentGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringDeploymentGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringEndpointGroupAssociations with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringEndpointGroupAssociationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringEndpointGroupAssociationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringEndpointGroupAssociation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringEndpointGroupAssociations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringDeploymentGroups', () => { - it('invokes listMirroringDeploymentGroups without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - ]; - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringDeploymentGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroups with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringDeploymentGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeploymentGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringDeploymentGroups without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - ]; - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringDeploymentGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroupsStream without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + ]; + client.descriptors.page.listMirroringDeploymentGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + ) => { + 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.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroups with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringDeploymentGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringDeploymentGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeploymentGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeploymentGroupsStream with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeploymentGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringDeploymentGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMirroringDeploymentGroups, + request, + ), + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroupsStream without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - ]; - client.descriptors.page.listMirroringDeploymentGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup) => { - 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.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeploymentGroups, request)); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeploymentGroups without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup(), + ), + ]; + client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[] = + []; + const iterable = client.listMirroringDeploymentGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentGroupsStream with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeploymentGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringDeploymentGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeploymentGroups, request)); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeploymentGroups with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringDeploymentGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeploymentGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMirroringDeployments', () => { + it('invokes listMirroringDeployments without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + ]; + client.innerApiCalls.listMirroringDeployments = + stubSimpleCall(expectedResponse); + const [response] = await client.listMirroringDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMirroringDeploymentGroups without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeploymentGroup()), - ]; - client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[] = []; - const iterable = client.listMirroringDeploymentGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMirroringDeployments without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + ]; + client.innerApiCalls.listMirroringDeployments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMirroringDeployments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMirroringDeploymentGroups with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeploymentGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringDeploymentGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeploymentGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeploymentGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMirroringDeployments', () => { - it('invokes listMirroringDeployments without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - ]; - client.innerApiCalls.listMirroringDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listMirroringDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMirroringDeployments without error using callback', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - ]; - client.innerApiCalls.listMirroringDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMirroringDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMirroringDeployments with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMirroringDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMirroringDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMirroringDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMirroringDeployments with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMirroringDeployments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMirroringDeployments(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMirroringDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMirroringDeploymentsStream without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - ]; - client.descriptors.page.listMirroringDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMirroringDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment) => { - 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.listMirroringDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeployments, request)); - assert( - (client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listMirroringDeploymentsStream without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + ]; + client.descriptors.page.listMirroringDeployments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMirroringDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + ) => { + 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.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMirroringDeployments, request), + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMirroringDeploymentsStream with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMirroringDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMirroringDeployments, request)); - assert( - (client.descriptors.page.listMirroringDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listMirroringDeploymentsStream with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeployments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMirroringDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMirroringDeployments, request), + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listMirroringDeployments without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment()), - ]; - client.descriptors.page.listMirroringDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[] = []; - const iterable = client.listMirroringDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeployments without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.MirroringDeployment(), + ), + ]; + client.descriptors.page.listMirroringDeployments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[] = + []; + const iterable = client.listMirroringDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listMirroringDeployments with error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMirroringDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMirroringDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMirroringDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMirroringDeployments with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListMirroringDeploymentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMirroringDeployments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMirroringDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IMirroringDeployment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMirroringDeployments + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMirroringDeployments + .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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 mirroringModule.v1alpha1.MirroringClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 mirroringModule.v1alpha1.MirroringClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new mirroringModule.v1alpha1.MirroringClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1alpha1.MirroringClient({ + 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1alpha1.MirroringClient({ + 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 mirroringModule.v1alpha1.MirroringClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 mirroringModule.v1alpha1.MirroringClient({ + 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 mirroringModule.v1alpha1.MirroringClient({ + 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.IOperation[] = []; + 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 mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('forwardingRule', async () => { - const fakePath = "/rendered/path/forwardingRule"; - const expectedParameters = { - project: "projectValue", - forwarding_rule: "forwardingRuleValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.forwardingRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.forwardingRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('forwardingRulePath', () => { - const result = client.forwardingRulePath("projectValue", "forwardingRuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromForwardingRuleName', () => { - const result = client.matchProjectFromForwardingRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchForwardingRuleFromForwardingRuleName', () => { - const result = client.matchForwardingRuleFromForwardingRuleName(fakePath); - assert.strictEqual(result, "forwardingRuleValue"); - assert((client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('forwardingRule', async () => { + const fakePath = '/rendered/path/forwardingRule'; + const expectedParameters = { + project: 'projectValue', + forwarding_rule: 'forwardingRuleValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.forwardingRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.forwardingRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('forwardingRulePath', () => { + const result = client.forwardingRulePath( + 'projectValue', + 'forwardingRuleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.forwardingRulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromForwardingRuleName', () => { + const result = client.matchProjectFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchForwardingRuleFromForwardingRuleName', () => { + const result = + client.matchForwardingRuleFromForwardingRuleName(fakePath); + assert.strictEqual(result, 'forwardingRuleValue'); + assert( + (client.pathTemplates.forwardingRulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new mirroringModule.v1alpha1.MirroringClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new mirroringModule.v1alpha1.MirroringClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_network_security_v1.ts b/packages/google-cloud-networksecurity/test/gapic_network_security_v1.ts index a5100689c406..887a1455de96 100644 --- a/packages/google-cloud-networksecurity/test/gapic_network_security_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_network_security_v1.ts @@ -19,9580 +19,13202 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as networksecurityModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.NetworkSecurityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient(); + 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 = networksecurityModule.v1.NetworkSecurityClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = networksecurityModule.v1.NetworkSecurityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.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 = + networksecurityModule.v1.NetworkSecurityClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networksecurityModule.v1.NetworkSecurityClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1.NetworkSecurityClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1.NetworkSecurityClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1.NetworkSecurityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + 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 networksecurityModule.v1.NetworkSecurityClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1.NetworkSecurityClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 networksecurityModule.v1.NetworkSecurityClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has port', () => { - const port = networksecurityModule.v1.NetworkSecurityClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = networksecurityModule.v1.NetworkSecurityClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - await client.initialize(); - assert(client.networkSecurityStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + await client.initialize(); + assert(client.networkSecurityStub); + }); - it('has close method for the initialized client', done => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.networkSecurityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.networkSecurityStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the non-initialized client', done => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + 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 networksecurityModule.v1.NetworkSecurityClient({ - 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); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + 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('getAuthorizationPolicy', () => { + it('invokes getAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getAuthorizationPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAuthorizationPolicy', () => { - it('invokes getAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthorizationPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthorizationPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + }); + }); + + describe('getBackendAuthenticationConfig', () => { + it('invokes getBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ); + client.innerApiCalls.getBackendAuthenticationConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getBackendAuthenticationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - }); + it('invokes getBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ); + client.innerApiCalls.getBackendAuthenticationConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getBackendAuthenticationConfig', () => { - it('invokes getBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig() - ); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getBackendAuthenticationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackendAuthenticationConfig with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig() - ); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackendAuthenticationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackendAuthenticationConfig with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getBackendAuthenticationConfig(request), + expectedError, + ); + }); + }); + + describe('getServerTlsPolicy', () => { + it('invokes getServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getServerTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServerTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IServerTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBackendAuthenticationConfig(request), expectedError); - }); + it('invokes getServerTlsPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServerTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getServerTlsPolicy', () => { - it('invokes getServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getServerTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getServerTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + }); + }); + + describe('getClientTlsPolicy', () => { + it('invokes getClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getClientTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServerTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IServerTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getClientTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IClientTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getClientTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - }); + it('invokes getClientTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + }); + }); + + describe('getGatewaySecurityPolicy', () => { + it('invokes getGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ); + client.innerApiCalls.getGatewaySecurityPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getGatewaySecurityPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getClientTlsPolicy', () => { - it('invokes getClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getClientTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ); + client.innerApiCalls.getGatewaySecurityPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getClientTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IClientTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getGatewaySecurityPolicy(request), + expectedError, + ); + }); + }); + + describe('getGatewaySecurityPolicyRule', () => { + it('invokes getGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ); + client.innerApiCalls.getGatewaySecurityPolicyRule = + stubSimpleCall(expectedResponse); + const [response] = await client.getGatewaySecurityPolicyRule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - }); + it('invokes getGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ); + client.innerApiCalls.getGatewaySecurityPolicyRule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getGatewaySecurityPolicy', () => { - it('invokes getGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy() - ); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getGatewaySecurityPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicyRule with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy() - ); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGatewaySecurityPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicyRule with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getGatewaySecurityPolicyRule(request), + expectedError, + ); + }); + }); + + describe('getUrlList', () => { + it('invokes getUrlList without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ); + client.innerApiCalls.getUrlList = stubSimpleCall(expectedResponse); + const [response] = await client.getUrlList(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUrlList without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ); + client.innerApiCalls.getUrlList = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUrlList( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IUrlList | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGatewaySecurityPolicy(request), expectedError); - }); + it('invokes getUrlList with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getUrlList = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getGatewaySecurityPolicyRule', () => { - it('invokes getGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule() - ); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall(expectedResponse); - const [response] = await client.getGatewaySecurityPolicyRule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUrlList with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getUrlList(request), expectedError); + }); + }); + + describe('getTlsInspectionPolicy', () => { + it('invokes getTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ); + client.innerApiCalls.getTlsInspectionPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getTlsInspectionPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule() - ); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGatewaySecurityPolicyRule( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ); + client.innerApiCalls.getTlsInspectionPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTlsInspectionPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGatewaySecurityPolicyRule(request), expectedError); - }); + it('invokes getTlsInspectionPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getTlsInspectionPolicy(request), + expectedError, + ); + }); + }); + + describe('getAuthzPolicy', () => { + it('invokes getAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ); + client.innerApiCalls.getAuthzPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAuthzPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getUrlList', () => { - it('invokes getUrlList without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UrlList() - ); - client.innerApiCalls.getUrlList = stubSimpleCall(expectedResponse); - const [response] = await client.getUrlList(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ); + client.innerApiCalls.getAuthzPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthzPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IAuthzPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UrlList() - ); - client.innerApiCalls.getUrlList = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUrlList( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IUrlList|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthzPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthzPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUrlList = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthzPolicy with closed client', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAuthzPolicy(request), expectedError); + }); + }); + + describe('createAuthorizationPolicy', () => { + it('invokes createAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUrlList(request), expectedError); - }); + it('invokes createAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getTlsInspectionPolicy', () => { - it('invokes getTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy() - ); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getTlsInspectionPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy() - ); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTlsInspectionPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTlsInspectionPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getTlsInspectionPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTlsInspectionPolicy(request), expectedError); - }); + it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAuthorizationPolicy', () => { + it('invokes updateAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAuthzPolicy', () => { - it('invokes getAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AuthzPolicy() - ); - client.innerApiCalls.getAuthzPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthzPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AuthzPolicy() - ); - client.innerApiCalls.getAuthzPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthzPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAuthzPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthzPolicy with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthzPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthzPolicy with closed client', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAuthzPolicy(request), expectedError); - }); + it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createAuthorizationPolicy', () => { - it('invokes createAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAuthorizationPolicy', () => { + it('invokes deleteAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createBackendAuthenticationConfig', () => { + it('invokes createBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAuthorizationPolicy', () => { - it('invokes updateAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateBackendAuthenticationConfig', () => { + it('invokes updateBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAuthorizationPolicy', () => { - it('invokes deleteAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteBackendAuthenticationConfig', () => { + it('invokes deleteBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createBackendAuthenticationConfig', () => { - it('invokes createBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createServerTlsPolicy', () => { + it('invokes createServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateBackendAuthenticationConfig', () => { - it('invokes updateBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateServerTlsPolicy', () => { + it('invokes updateServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteBackendAuthenticationConfig', () => { - it('invokes deleteBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteServerTlsPolicy', () => { + it('invokes deleteServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createClientTlsPolicy', () => { + it('invokes createClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createServerTlsPolicy', () => { - it('invokes createServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateClientTlsPolicy', () => { + it('invokes updateClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateServerTlsPolicy', () => { - it('invokes updateServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteClientTlsPolicy', () => { + it('invokes deleteClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteServerTlsPolicy', () => { - it('invokes deleteServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGatewaySecurityPolicy', () => { + it('invokes createGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createClientTlsPolicy', () => { - it('invokes createClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateGatewaySecurityPolicy', () => { + it('invokes updateGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateClientTlsPolicy', () => { - it('invokes updateClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGatewaySecurityPolicy', () => { + it('invokes deleteGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteClientTlsPolicy', () => { - it('invokes deleteClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createGatewaySecurityPolicy', () => { - it('invokes createGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateGatewaySecurityPolicy', () => { - it('invokes updateGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteGatewaySecurityPolicy', () => { - it('invokes deleteGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - - describe('createGatewaySecurityPolicyRule', () => { - it('invokes createGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + }); + + describe('createGatewaySecurityPolicyRule', () => { + it('invokes createGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateGatewaySecurityPolicyRule', () => { - it('invokes updateGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteGatewaySecurityPolicyRule', () => { - it('invokes deleteGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateGatewaySecurityPolicyRule', () => { + it('invokes updateGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createUrlList', () => { - it('invokes createUrlList without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.createUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUrlList without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createUrlList with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGatewaySecurityPolicyRule', () => { + it('invokes deleteGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUrlList with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateUrlListProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateUrlListProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateUrlList', () => { - it('invokes updateUrlList without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateUrlList without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createUrlList', () => { + it('invokes createUrlList without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateUrlList with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createUrlList without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateUrlList with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createUrlList with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateUrlListProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createUrlList with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateUrlListProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateUrlListProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteUrlList', () => { - it('invokes deleteUrlList without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateUrlListProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateUrlList', () => { + it('invokes updateUrlList without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUrlList without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IUrlList, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUrlList with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUrlList with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteUrlListProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateUrlListProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteUrlListProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateUrlListProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteUrlList', () => { + it('invokes deleteUrlList without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createTlsInspectionPolicy', () => { - it('invokes createTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUrlList without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUrlList with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUrlList with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteUrlListProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteUrlListProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createTlsInspectionPolicy', () => { + it('invokes createTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateTlsInspectionPolicy', () => { - it('invokes updateTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateTlsInspectionPolicy', () => { + it('invokes updateTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteTlsInspectionPolicy', () => { - it('invokes deleteTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteTlsInspectionPolicy', () => { + it('invokes deleteTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAuthzPolicy', () => { - it('invokes createAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createAuthzPolicy', () => { + it('invokes createAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateAuthzPolicy', () => { - it('invokes updateAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAuthzPolicy', () => { + it('invokes updateAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAuthzPolicy', () => { + it('invokes deleteAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAuthzPolicy', () => { - it('invokes deleteAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAuthorizationPolicies', () => { + it('invokes listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listAuthorizationPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAuthorizationPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAuthorizationPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAuthorizationPolicies', () => { - it('invokes listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAuthorizationPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listAuthorizationPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAuthorizationPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAuthorizationPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + ) => { + 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.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAuthorizationPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.AuthorizationPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AuthorizationPolicy) => { - 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.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[] = + []; + const iterable = client.listAuthorizationPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AuthorizationPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAuthorizationPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listBackendAuthenticationConfigs', () => { + it('invokes listBackendAuthenticationConfigs without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + ]; + client.innerApiCalls.listBackendAuthenticationConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listBackendAuthenticationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[] = []; - const iterable = client.listAuthorizationPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listBackendAuthenticationConfigs without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + ]; + client.innerApiCalls.listBackendAuthenticationConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackendAuthenticationConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAuthorizationPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IAuthorizationPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listBackendAuthenticationConfigs', () => { - it('invokes listBackendAuthenticationConfigs without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - ]; - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listBackendAuthenticationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listBackendAuthenticationConfigs with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listBackendAuthenticationConfigs(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackendAuthenticationConfigs without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - ]; - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackendAuthenticationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listBackendAuthenticationConfigsStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + ]; + client.descriptors.page.listBackendAuthenticationConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackendAuthenticationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + ) => { + 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.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listBackendAuthenticationConfigs, + request, + ), + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listBackendAuthenticationConfigs with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackendAuthenticationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listBackendAuthenticationConfigsStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackendAuthenticationConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackendAuthenticationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listBackendAuthenticationConfigs, + request, + ), + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listBackendAuthenticationConfigsStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - ]; - client.descriptors.page.listBackendAuthenticationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackendAuthenticationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig) => { - 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.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackendAuthenticationConfigs, request)); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listBackendAuthenticationConfigs without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig(), + ), + ]; + client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[] = + []; + const iterable = client.listBackendAuthenticationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listBackendAuthenticationConfigsStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackendAuthenticationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackendAuthenticationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackendAuthenticationConfigs, request)); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listBackendAuthenticationConfigs with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackendAuthenticationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listServerTlsPolicies', () => { + it('invokes listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listBackendAuthenticationConfigs without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.BackendAuthenticationConfig()), - ]; - client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[] = []; - const iterable = client.listBackendAuthenticationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listServerTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IServerTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackendAuthenticationConfigs with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackendAuthenticationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IBackendAuthenticationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listServerTlsPolicies', () => { - it('invokes listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listServerTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listServerTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IServerTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + ) => { + 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.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ServerTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ServerTlsPolicy) => { - 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.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IServerTlsPolicy[] = + []; + const iterable = client.listServerTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ServerTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServerTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IServerTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listClientTlsPolicies', () => { + it('invokes listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listClientTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IServerTlsPolicy[] = []; - const iterable = client.listServerTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listClientTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClientTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IClientTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServerTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IServerTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listClientTlsPolicies', () => { - it('invokes listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listClientTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClientTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listClientTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listClientTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClientTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IClientTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + ) => { + 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.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClientTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ClientTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listClientTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ClientTlsPolicy) => { - 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.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IClientTlsPolicy[] = + []; + const iterable = client.listClientTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listClientTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ClientTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClientTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IClientTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listGatewaySecurityPolicies', () => { + it('invokes listGatewaySecurityPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listGatewaySecurityPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IClientTlsPolicy[] = []; - const iterable = client.listClientTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listGatewaySecurityPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGatewaySecurityPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClientTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IClientTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listGatewaySecurityPolicies', () => { - it('invokes listGatewaySecurityPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - ]; - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listGatewaySecurityPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listGatewaySecurityPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listGatewaySecurityPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - ]; - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGatewaySecurityPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGatewaySecurityPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + ) => { + 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.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicies, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGatewaySecurityPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGatewaySecurityPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicies, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - ]; - client.descriptors.page.listGatewaySecurityPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGatewaySecurityPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy) => { - 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.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicies, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGatewaySecurityPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[] = + []; + const iterable = client.listGatewaySecurityPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGatewaySecurityPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicies, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGatewaySecurityPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGatewaySecurityPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listGatewaySecurityPolicyRules', () => { + it('invokes listGatewaySecurityPolicyRules without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicyRules = + stubSimpleCall(expectedResponse); + const [response] = await client.listGatewaySecurityPolicyRules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listGatewaySecurityPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicy()), - ]; - client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[] = []; - const iterable = client.listGatewaySecurityPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listGatewaySecurityPolicyRules without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicyRules = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGatewaySecurityPolicyRules( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGatewaySecurityPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGatewaySecurityPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listGatewaySecurityPolicyRules', () => { - it('invokes listGatewaySecurityPolicyRules without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - ]; - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall(expectedResponse); - const [response] = await client.listGatewaySecurityPolicyRules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRules with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listGatewaySecurityPolicyRules(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listGatewaySecurityPolicyRules without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - ]; - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGatewaySecurityPolicyRules( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRulesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicyRules.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGatewaySecurityPolicyRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + ) => { + 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.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicyRules, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPolicyRules with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGatewaySecurityPolicyRules(request), expectedError); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRulesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicyRules.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGatewaySecurityPolicyRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicyRules, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPolicyRulesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - ]; - client.descriptors.page.listGatewaySecurityPolicyRules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGatewaySecurityPolicyRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule) => { - 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.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicyRules, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGatewaySecurityPolicyRules without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[] = + []; + const iterable = client.listGatewaySecurityPolicyRulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listGatewaySecurityPolicyRulesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicyRules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGatewaySecurityPolicyRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicyRules, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGatewaySecurityPolicyRules with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGatewaySecurityPolicyRulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listUrlLists', () => { + it('invokes listUrlLists without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + ]; + client.innerApiCalls.listUrlLists = stubSimpleCall(expectedResponse); + const [response] = await client.listUrlLists(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listGatewaySecurityPolicyRules without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.GatewaySecurityPolicyRule()), - ]; - client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[] = []; - const iterable = client.listGatewaySecurityPolicyRulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listUrlLists without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + ]; + client.innerApiCalls.listUrlLists = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUrlLists( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IUrlList[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGatewaySecurityPolicyRules with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGatewaySecurityPolicyRulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IGatewaySecurityPolicyRule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listUrlLists', () => { - it('invokes listUrlLists without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - ]; - client.innerApiCalls.listUrlLists = stubSimpleCall(expectedResponse); - const [response] = await client.listUrlLists(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUrlLists with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUrlLists = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listUrlLists(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listUrlLists without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - ]; - client.innerApiCalls.listUrlLists = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUrlLists( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IUrlList[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUrlListsStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + ]; + client.descriptors.page.listUrlLists.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUrlListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.UrlList[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.UrlList) => { + 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.listUrlLists.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUrlLists, request), + ); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listUrlLists with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUrlLists = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUrlLists(request), expectedError); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUrlListsStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listUrlListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.UrlList[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.UrlList) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUrlLists, request), + ); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listUrlListsStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - ]; - client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUrlListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.UrlList[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.UrlList) => { - 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.listUrlLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUrlLists, request)); - assert( - (client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listUrlLists without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UrlList(), + ), + ]; + client.descriptors.page.listUrlLists.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IUrlList[] = []; + const iterable = client.listUrlListsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUrlLists.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listUrlListsStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUrlListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.UrlList[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.UrlList) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUrlLists, request)); - assert( - (client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listUrlLists with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUrlLists.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUrlListsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IUrlList[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUrlLists.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listTlsInspectionPolicies', () => { + it('invokes listTlsInspectionPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + ]; + client.innerApiCalls.listTlsInspectionPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listTlsInspectionPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listUrlLists without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.UrlList()), - ]; - client.descriptors.page.listUrlLists.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IUrlList[] = []; - const iterable = client.listUrlListsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listTlsInspectionPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + ]; + client.innerApiCalls.listTlsInspectionPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTlsInspectionPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUrlLists with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUrlLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUrlListsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IUrlList[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listTlsInspectionPolicies', () => { - it('invokes listTlsInspectionPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - ]; - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listTlsInspectionPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTlsInspectionPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listTlsInspectionPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listTlsInspectionPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - ]; - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTlsInspectionPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTlsInspectionPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + ]; + client.descriptors.page.listTlsInspectionPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTlsInspectionPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + ) => { + 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.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listTlsInspectionPolicies, request), + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listTlsInspectionPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTlsInspectionPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTlsInspectionPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTlsInspectionPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listTlsInspectionPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listTlsInspectionPolicies, request), + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listTlsInspectionPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - ]; - client.descriptors.page.listTlsInspectionPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTlsInspectionPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy) => { - 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.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTlsInspectionPolicies, request)); - assert( - (client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listTlsInspectionPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy(), + ), + ]; + client.descriptors.page.listTlsInspectionPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[] = + []; + const iterable = client.listTlsInspectionPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listTlsInspectionPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTlsInspectionPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTlsInspectionPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.TlsInspectionPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTlsInspectionPolicies, request)); - assert( - (client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listTlsInspectionPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTlsInspectionPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTlsInspectionPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listAuthzPolicies', () => { + it('invokes listAuthzPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + ]; + client.innerApiCalls.listAuthzPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAuthzPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listTlsInspectionPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.TlsInspectionPolicy()), - ]; - client.descriptors.page.listTlsInspectionPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[] = []; - const iterable = client.listTlsInspectionPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listAuthzPolicies without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + ]; + client.innerApiCalls.listAuthzPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAuthzPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IAuthzPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTlsInspectionPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTlsInspectionPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTlsInspectionPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.ITlsInspectionPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAuthzPolicies', () => { - it('invokes listAuthzPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - ]; - client.innerApiCalls.listAuthzPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAuthzPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAuthzPolicies without error using callback', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - ]; - client.innerApiCalls.listAuthzPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAuthzPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAuthzPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAuthzPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAuthzPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAuthzPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthzPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAuthzPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAuthzPolicies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAuthzPoliciesStream without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - ]; - client.descriptors.page.listAuthzPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAuthzPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AuthzPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AuthzPolicy) => { - 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.listAuthzPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthzPolicies, request)); - assert( - (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listAuthzPoliciesStream without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + ]; + client.descriptors.page.listAuthzPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAuthzPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AuthzPolicy[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AuthzPolicy) => { + 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.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthzPolicies, request), + ); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAuthzPoliciesStream with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthzPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAuthzPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AuthzPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AuthzPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthzPolicies, request)); - assert( - (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listAuthzPoliciesStream with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthzPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAuthzPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AuthzPolicy[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AuthzPolicy) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthzPolicies, request), + ); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listAuthzPolicies without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AuthzPolicy()), - ]; - client.descriptors.page.listAuthzPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IAuthzPolicy[] = []; - const iterable = client.listAuthzPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthzPolicies without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AuthzPolicy(), + ), + ]; + client.descriptors.page.listAuthzPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IAuthzPolicy[] = + []; + const iterable = client.listAuthzPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listAuthzPolicies with error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthzPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAuthzPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IAuthzPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthzPolicies with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthzPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAuthzPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IAuthzPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAuthzPolicies.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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1.NetworkSecurityClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new networksecurityModule.v1.NetworkSecurityClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1.NetworkSecurityClient({ + 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1.NetworkSecurityClient({ + 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1.NetworkSecurityClient({ + 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 networksecurityModule.v1.NetworkSecurityClient({ + 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.IOperation[] = []; + 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 networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new networksecurityModule.v1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new networksecurityModule.v1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_network_security_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_network_security_v1alpha1.ts index 5cbc83b5d54f..9f357c6b74eb 100644 --- a/packages/google-cloud-networksecurity/test/gapic_network_security_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_network_security_v1alpha1.ts @@ -19,9718 +19,13273 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as networksecurityModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.NetworkSecurityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); + 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 = networksecurityModule.v1alpha1.NetworkSecurityClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networksecurityModule.v1alpha1.NetworkSecurityClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networksecurityModule.v1alpha1.NetworkSecurityClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = networksecurityModule.v1alpha1.NetworkSecurityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1alpha1.NetworkSecurityClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1alpha1.NetworkSecurityClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1alpha1.NetworkSecurityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has port', () => { + const port = networksecurityModule.v1alpha1.NetworkSecurityClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has port', () => { - const port = networksecurityModule.v1alpha1.NetworkSecurityClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('should create a client with no option', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); + assert(client); + }); - it('should create a client with no option', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient(); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + fallback: true, + }); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - fallback: true, - }); - assert(client); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + await client.initialize(); + assert(client.networkSecurityStub); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - await client.initialize(); - assert(client.networkSecurityStub); + it('has close method for the initialized client', (done) => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.networkSecurityStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the initialized client', done => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.networkSecurityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the non-initialized client', done => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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('getAuthorizationPolicy', () => { + it('invokes getAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getAuthorizationPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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); - }); + it('invokes getAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAuthorizationPolicy', () => { - it('invokes getAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthorizationPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthorizationPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + }); + }); + + describe('getBackendAuthenticationConfig', () => { + it('invokes getBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ); + client.innerApiCalls.getBackendAuthenticationConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getBackendAuthenticationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ); + client.innerApiCalls.getBackendAuthenticationConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthorizationPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - }); + it('invokes getBackendAuthenticationConfig with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getBackendAuthenticationConfig', () => { - it('invokes getBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig() - ); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getBackendAuthenticationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackendAuthenticationConfig with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getBackendAuthenticationConfig(request), + expectedError, + ); + }); + }); + + describe('getServerTlsPolicy', () => { + it('invokes getServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getServerTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig() - ); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackendAuthenticationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServerTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackendAuthenticationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getServerTlsPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServerTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackendAuthenticationConfig with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBackendAuthenticationConfig(request), expectedError); - }); + it('invokes getServerTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + }); + }); + + describe('getClientTlsPolicy', () => { + it('invokes getClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getClientTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getServerTlsPolicy', () => { - it('invokes getServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getServerTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getClientTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServerTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getClientTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + }); + }); + + describe('getGatewaySecurityPolicy', () => { + it('invokes getGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ); + client.innerApiCalls.getGatewaySecurityPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getGatewaySecurityPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getServerTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - }); + it('invokes getGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ); + client.innerApiCalls.getGatewaySecurityPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getClientTlsPolicy', () => { - it('invokes getClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getClientTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getClientTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getGatewaySecurityPolicy(request), + expectedError, + ); + }); + }); + + describe('getGatewaySecurityPolicyRule', () => { + it('invokes getGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ); + client.innerApiCalls.getGatewaySecurityPolicyRule = + stubSimpleCall(expectedResponse); + const [response] = await client.getGatewaySecurityPolicyRule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ); + client.innerApiCalls.getGatewaySecurityPolicyRule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getClientTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - }); + it('invokes getGatewaySecurityPolicyRule with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getGatewaySecurityPolicy', () => { - it('invokes getGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy() - ); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getGatewaySecurityPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGatewaySecurityPolicyRule with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getGatewaySecurityPolicyRule(request), + expectedError, + ); + }); + }); + + describe('getUrlList', () => { + it('invokes getUrlList without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ); + client.innerApiCalls.getUrlList = stubSimpleCall(expectedResponse); + const [response] = await client.getUrlList(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy() - ); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGatewaySecurityPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUrlList without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ); + client.innerApiCalls.getUrlList = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUrlList( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IUrlList | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGatewaySecurityPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUrlList with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getUrlList = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGatewaySecurityPolicy(request), expectedError); - }); + it('invokes getUrlList with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getUrlList(request), expectedError); + }); + }); + + describe('getTlsInspectionPolicy', () => { + it('invokes getTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ); + client.innerApiCalls.getTlsInspectionPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getTlsInspectionPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getGatewaySecurityPolicyRule', () => { - it('invokes getGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule() - ); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall(expectedResponse); - const [response] = await client.getGatewaySecurityPolicyRule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ); + client.innerApiCalls.getTlsInspectionPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule() - ); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGatewaySecurityPolicyRule( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTlsInspectionPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGatewaySecurityPolicyRule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTlsInspectionPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getTlsInspectionPolicy(request), + expectedError, + ); + }); + }); + + describe('getAuthzPolicy', () => { + it('invokes getAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ); + client.innerApiCalls.getAuthzPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAuthzPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGatewaySecurityPolicyRule with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGatewaySecurityPolicyRule(request), expectedError); - }); + it('invokes getAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ); + client.innerApiCalls.getAuthzPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthzPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getUrlList', () => { - it('invokes getUrlList without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UrlList() - ); - client.innerApiCalls.getUrlList = stubSimpleCall(expectedResponse); - const [response] = await client.getUrlList(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthzPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthzPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UrlList() - ); - client.innerApiCalls.getUrlList = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUrlList( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IUrlList|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthzPolicy with closed client', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAuthzPolicy(request), expectedError); + }); + }); + + describe('createAuthorizationPolicy', () => { + it('invokes createAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUrlList = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUrlList with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUrlList(request), expectedError); - }); + it('invokes createAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getTlsInspectionPolicy', () => { - it('invokes getTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy() - ); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getTlsInspectionPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy() - ); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTlsInspectionPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getTlsInspectionPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTlsInspectionPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAuthorizationPolicy', () => { + it('invokes updateAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTlsInspectionPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTlsInspectionPolicy(request), expectedError); - }); + it('invokes updateAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAuthzPolicy', () => { - it('invokes getAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy() - ); - client.innerApiCalls.getAuthzPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthzPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy() - ); - client.innerApiCalls.getAuthzPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthzPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAuthzPolicy with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthzPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getAuthzPolicy with closed client', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAuthzPolicy(request), expectedError); - }); + it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAuthorizationPolicy', () => { + it('invokes deleteAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAuthorizationPolicy', () => { - it('invokes createAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createBackendAuthenticationConfig', () => { + it('invokes createBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.createBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAuthorizationPolicy', () => { - it('invokes updateAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.createBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateBackendAuthenticationConfig', () => { + it('invokes updateBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.updateBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes updateBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest(), + ); + request.backendAuthenticationConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', + ['backendAuthenticationConfig', 'name'], + ); + request.backendAuthenticationConfig.name = defaultValue1; + const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.updateBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteAuthorizationPolicy', () => { - it('invokes deleteAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteBackendAuthenticationConfig', () => { + it('invokes deleteBackendAuthenticationConfig without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(expectedResponse); + const [operation] = + await client.deleteBackendAuthenticationConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackendAuthenticationConfig without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackendAuthenticationConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackendAuthenticationConfig with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteBackendAuthenticationConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackendAuthenticationConfig with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackendAuthenticationConfig = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = + await client.deleteBackendAuthenticationConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteBackendAuthenticationConfigProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteBackendAuthenticationConfigProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeleteBackendAuthenticationConfigProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteBackendAuthenticationConfigProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createServerTlsPolicy', () => { + it('invokes createServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createBackendAuthenticationConfig', () => { - it('invokes createBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateBackendAuthenticationConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateServerTlsPolicy', () => { + it('invokes updateServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes updateServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateBackendAuthenticationConfig', () => { - it('invokes updateBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteServerTlsPolicy', () => { + it('invokes deleteServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest() - ); - request.backendAuthenticationConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateBackendAuthenticationConfigRequest', ['backendAuthenticationConfig', 'name']); - request.backendAuthenticationConfig.name = defaultValue1; - const expectedHeaderRequestParams = `backend_authentication_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createClientTlsPolicy', () => { + it('invokes createClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteBackendAuthenticationConfig', () => { - it('invokes deleteBackendAuthenticationConfig without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackendAuthenticationConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackendAuthenticationConfig( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackendAuthenticationConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackendAuthenticationConfig with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteBackendAuthenticationConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackendAuthenticationConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackendAuthenticationConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackendAuthenticationConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteBackendAuthenticationConfigProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteBackendAuthenticationConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateClientTlsPolicy', () => { + it('invokes updateClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteBackendAuthenticationConfigProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes updateClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackendAuthenticationConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createServerTlsPolicy', () => { - it('invokes createServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteClientTlsPolicy', () => { + it('invokes deleteClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateServerTlsPolicy', () => { - it('invokes updateServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGatewaySecurityPolicy', () => { + it('invokes createGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkCreateGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateGatewaySecurityPolicy', () => { + it('invokes updateGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteServerTlsPolicy', () => { - it('invokes deleteServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest(), + ); + request.gatewaySecurityPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', + ['gatewaySecurityPolicy', 'name'], + ); + request.gatewaySecurityPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGatewaySecurityPolicy', () => { + it('invokes deleteGatewaySecurityPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGatewaySecurityPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGatewaySecurityPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteGatewaySecurityPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteGatewaySecurityPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteGatewaySecurityPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createClientTlsPolicy', () => { - it('invokes createClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteGatewaySecurityPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteGatewaySecurityPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGatewaySecurityPolicyRule', () => { + it('invokes createGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkCreateGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateGatewaySecurityPolicyRule', () => { + it('invokes updateGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateClientTlsPolicy', () => { - it('invokes updateClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.updateGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest(), + ); + request.gatewaySecurityPolicyRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', + ['gatewaySecurityPolicyRule', 'name'], + ); + request.gatewaySecurityPolicyRule.name = defaultValue1; + const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGatewaySecurityPolicyRule', () => { + it('invokes deleteGatewaySecurityPolicyRule without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGatewaySecurityPolicyRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteGatewaySecurityPolicyRule without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGatewaySecurityPolicyRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteGatewaySecurityPolicyRule with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.deleteGatewaySecurityPolicyRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteClientTlsPolicy', () => { - it('invokes deleteClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGatewaySecurityPolicyRule with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGatewaySecurityPolicyRule = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteGatewaySecurityPolicyRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyRuleProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteGatewaySecurityPolicyRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteGatewaySecurityPolicyRuleProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteGatewaySecurityPolicyRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createUrlList', () => { + it('invokes createUrlList without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createUrlList without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createUrlList with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createUrlList with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateUrlListProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createGatewaySecurityPolicy', () => { - it('invokes createGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateUrlListProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateUrlList', () => { + it('invokes updateUrlList without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IUrlList, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateUrlList with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest(), + ); + request.urlList ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', + ['urlList', 'name'], + ); + request.urlList.name = defaultValue1; + const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateUrlListProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateUrlListProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteUrlList', () => { + it('invokes deleteUrlList without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUrlList = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteUrlList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteUrlList without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUrlList = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUrlList( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateGatewaySecurityPolicy', () => { - it('invokes updateGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUrlList with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUrlList = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteUrlList(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUrlList with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUrlList = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteUrlList(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUrlList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteUrlListProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteUrlListProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest() - ); - request.gatewaySecurityPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRequest', ['gatewaySecurityPolicy', 'name']); - request.gatewaySecurityPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteUrlListProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteUrlListProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createTlsInspectionPolicy', () => { + it('invokes createTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteGatewaySecurityPolicy', () => { - it('invokes deleteGatewaySecurityPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGatewaySecurityPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteGatewaySecurityPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGatewaySecurityPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateTlsInspectionPolicy', () => { + it('invokes updateTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGatewaySecurityPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGatewaySecurityPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGatewaySecurityPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGatewaySecurityPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteGatewaySecurityPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest(), + ); + request.tlsInspectionPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', + ['tlsInspectionPolicy', 'name'], + ); + request.tlsInspectionPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGatewaySecurityPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteTlsInspectionPolicy', () => { + it('invokes deleteTlsInspectionPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTlsInspectionPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteTlsInspectionPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createGatewaySecurityPolicyRule', () => { - it('invokes createGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteTlsInspectionPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTlsInspectionPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTlsInspectionPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteTlsInspectionPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteTlsInspectionPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateGatewaySecurityPolicyRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteTlsInspectionPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteTlsInspectionPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateGatewaySecurityPolicyRule', () => { - it('invokes updateGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest() - ); - request.gatewaySecurityPolicyRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateGatewaySecurityPolicyRuleRequest', ['gatewaySecurityPolicyRule', 'name']); - request.gatewaySecurityPolicyRule.name = defaultValue1; - const expectedHeaderRequestParams = `gateway_security_policy_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteTlsInspectionPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteTlsInspectionPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteGatewaySecurityPolicyRule', () => { - it('invokes deleteGatewaySecurityPolicyRule without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGatewaySecurityPolicyRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGatewaySecurityPolicyRule without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGatewaySecurityPolicyRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGatewaySecurityPolicyRule with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGatewaySecurityPolicyRule(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteTlsInspectionPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteTlsInspectionPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createAuthzPolicy', () => { + it('invokes createAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGatewaySecurityPolicyRule with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteGatewaySecurityPolicyRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGatewaySecurityPolicyRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGatewaySecurityPolicyRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGatewaySecurityPolicyRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyRuleProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteGatewaySecurityPolicyRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGatewaySecurityPolicyRuleProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGatewaySecurityPolicyRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createUrlList', () => { - it('invokes createUrlList without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.createUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAuthzPolicy', () => { + it('invokes updateAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUrlList without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUrlList with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUrlList with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateUrlListRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest(), + ); + request.authzPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', + ['authzPolicy', 'name'], + ); + request.authzPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateUrlListProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateUrlListProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAuthzPolicy', () => { + it('invokes deleteAuthzPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthzPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAuthzPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteAuthzPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthzPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAuthzPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateUrlList', () => { - it('invokes updateUrlList without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthzPolicy with call error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAuthzPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateUrlList without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthzPolicy with LRO error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAuthzPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthzPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateUrlList with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthzPolicyProgress without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteAuthzPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateUrlList with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest() - ); - request.urlList ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateUrlListRequest', ['urlList', 'name']); - request.urlList.name = defaultValue1; - const expectedHeaderRequestParams = `url_list.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthzPolicyProgress with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAuthzPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAuthorizationPolicies', () => { + it('invokes listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listAuthorizationPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateUrlListProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listAuthorizationPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAuthorizationPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateUrlListProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listAuthorizationPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAuthorizationPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + ) => { + 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.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('deleteUrlList', () => { - it('invokes deleteUrlList without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteUrlList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteUrlList without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUrlList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUrlList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[] = + []; + const iterable = client.listAuthorizationPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteUrlList with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteUrlList(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAuthorizationPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listBackendAuthenticationConfigs', () => { + it('invokes listBackendAuthenticationConfigs without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + ]; + client.innerApiCalls.listBackendAuthenticationConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listBackendAuthenticationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUrlList with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteUrlListRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUrlList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteUrlList(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUrlList as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listBackendAuthenticationConfigs without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + ]; + client.innerApiCalls.listBackendAuthenticationConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackendAuthenticationConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteUrlListProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteUrlListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listBackendAuthenticationConfigs with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listBackendAuthenticationConfigs(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteUrlListProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listBackendAuthenticationConfigsStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + ]; + client.descriptors.page.listBackendAuthenticationConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackendAuthenticationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + ) => { + 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.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listBackendAuthenticationConfigs, + request, + ), + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteUrlListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listBackendAuthenticationConfigsStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackendAuthenticationConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackendAuthenticationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listBackendAuthenticationConfigs, + request, + ), + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('createTlsInspectionPolicy', () => { - it('invokes createTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listBackendAuthenticationConfigs without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig(), + ), + ]; + client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[] = + []; + const iterable = client.listBackendAuthenticationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes createTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listBackendAuthenticationConfigs with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackendAuthenticationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listBackendAuthenticationConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listServerTlsPolicies', () => { + it('invokes listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateTlsInspectionPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listServerTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + ) => { + 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.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkCreateTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listServerTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[] = + []; + const iterable = client.listServerTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('updateTlsInspectionPolicy', () => { - it('invokes updateTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServerTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listClientTlsPolicies', () => { + it('invokes listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listClientTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClientTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClientTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listClientTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest() - ); - request.tlsInspectionPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateTlsInspectionPolicyRequest', ['tlsInspectionPolicy', 'name']); - request.tlsInspectionPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `tls_inspection_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + ) => { + 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.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkUpdateTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listClientTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkUpdateTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('uses async iteration with listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[] = + []; + const iterable = client.listClientTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClientTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listGatewaySecurityPolicies', () => { + it('invokes listGatewaySecurityPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listGatewaySecurityPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteTlsInspectionPolicy', () => { - it('invokes deleteTlsInspectionPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteTlsInspectionPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGatewaySecurityPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteTlsInspectionPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTlsInspectionPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listGatewaySecurityPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteTlsInspectionPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteTlsInspectionPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGatewaySecurityPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + ) => { + 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.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicies, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteTlsInspectionPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteTlsInspectionPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTlsInspectionPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteTlsInspectionPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTlsInspectionPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGatewaySecurityPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicies, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeleteTlsInspectionPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteTlsInspectionPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listGatewaySecurityPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[] = + []; + const iterable = client.listGatewaySecurityPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeleteTlsInspectionPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('uses async iteration with listGatewaySecurityPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGatewaySecurityPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listGatewaySecurityPolicyRules', () => { + it('invokes listGatewaySecurityPolicyRules without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicyRules = + stubSimpleCall(expectedResponse); + const [response] = await client.listGatewaySecurityPolicyRules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteTlsInspectionPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listGatewaySecurityPolicyRules without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + ]; + client.innerApiCalls.listGatewaySecurityPolicyRules = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGatewaySecurityPolicyRules( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAuthzPolicy', () => { - it('invokes createAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRules with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listGatewaySecurityPolicyRules(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRulesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicyRules.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGatewaySecurityPolicyRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + ) => { + 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.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicyRules, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes createAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGatewaySecurityPolicyRulesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicyRules.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGatewaySecurityPolicyRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listGatewaySecurityPolicyRules, + request, + ), + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes createAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateAuthzPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listGatewaySecurityPolicyRules without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule(), + ), + ]; + client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[] = + []; + const iterable = client.listGatewaySecurityPolicyRulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkCreateAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listGatewaySecurityPolicyRules with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGatewaySecurityPolicyRulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listGatewaySecurityPolicyRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listUrlLists', () => { + it('invokes listUrlLists without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + ]; + client.innerApiCalls.listUrlLists = stubSimpleCall(expectedResponse); + const [response] = await client.listUrlLists(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listUrlLists without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + ]; + client.innerApiCalls.listUrlLists = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUrlLists( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IUrlList[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listUrlLists with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUrlLists = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listUrlLists(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUrlLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAuthzPolicy', () => { - it('invokes updateAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUrlListsStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + ]; + client.descriptors.page.listUrlLists.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUrlListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.UrlList[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1alpha1.UrlList) => { + 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.listUrlLists.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUrlLists, request), + ); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updateAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUrlListsStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listUrlListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.UrlList[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1alpha1.UrlList) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUrlLists, request), + ); + assert( + (client.descriptors.page.listUrlLists.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updateAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listUrlLists without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UrlList(), + ), + ]; + client.descriptors.page.listUrlLists.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IUrlList[] = + []; + const iterable = client.listUrlListsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUrlLists.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updateAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest() - ); - request.authzPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateAuthzPolicyRequest', ['authzPolicy', 'name']); - request.authzPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authz_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listUrlLists with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUrlLists.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUrlListsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IUrlList[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUrlLists.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listTlsInspectionPolicies', () => { + it('invokes listTlsInspectionPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + ]; + client.innerApiCalls.listTlsInspectionPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listTlsInspectionPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listTlsInspectionPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + ]; + client.innerApiCalls.listTlsInspectionPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTlsInspectionPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listTlsInspectionPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listTlsInspectionPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTlsInspectionPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listTlsInspectionPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + ]; + client.descriptors.page.listTlsInspectionPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTlsInspectionPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + ) => { + 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.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listTlsInspectionPolicies, request), + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('deleteAuthzPolicy', () => { - it('invokes deleteAuthzPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAuthzPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTlsInspectionPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTlsInspectionPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listTlsInspectionPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listTlsInspectionPolicies, request), + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteAuthzPolicy without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAuthzPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listTlsInspectionPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy(), + ), + ]; + client.descriptors.page.listTlsInspectionPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[] = + []; + const iterable = client.listTlsInspectionPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteAuthzPolicy with call error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAuthzPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listTlsInspectionPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTlsInspectionPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTlsInspectionPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listTlsInspectionPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listAuthzPolicies', () => { + it('invokes listAuthzPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + ]; + client.innerApiCalls.listAuthzPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAuthzPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthzPolicy with LRO error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteAuthzPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthzPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAuthzPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthzPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthzPolicies without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + ]; + client.innerApiCalls.listAuthzPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAuthzPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthzPolicyProgress without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAuthzPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listAuthzPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAuthzPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAuthzPolicies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthzPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthzPolicyProgress with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listAuthzPoliciesStream without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + ]; + client.descriptors.page.listAuthzPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAuthzPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + ) => { + 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.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthzPolicies, request), + ); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAuthzPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAuthzPoliciesStream with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthzPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAuthzPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthzPolicies, request), + ); + assert( + (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listAuthorizationPolicies', () => { - it('invokes listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAuthorizationPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAuthzPolicies without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy(), + ), + ]; + client.descriptors.page.listAuthzPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[] = + []; + const iterable = client.listAuthzPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAuthorizationPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAuthorizationPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAuthorizationPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAuthorizationPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy) => { - 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.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAuthorizationPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[] = []; - const iterable = client.listAuthorizationPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAuthorizationPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthorizationPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthzPolicies with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthzPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAuthzPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - - describe('listBackendAuthenticationConfigs', () => { - it('invokes listBackendAuthenticationConfigs without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - ]; - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listBackendAuthenticationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackendAuthenticationConfigs without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - ]; - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackendAuthenticationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackendAuthenticationConfigs with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackendAuthenticationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackendAuthenticationConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackendAuthenticationConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackendAuthenticationConfigsStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - ]; - client.descriptors.page.listBackendAuthenticationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackendAuthenticationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig) => { - 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.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackendAuthenticationConfigs, request)); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackendAuthenticationConfigsStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackendAuthenticationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackendAuthenticationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackendAuthenticationConfigs, request)); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackendAuthenticationConfigs without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.BackendAuthenticationConfig()), - ]; - client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[] = []; - const iterable = client.listBackendAuthenticationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackendAuthenticationConfigs with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListBackendAuthenticationConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackendAuthenticationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IBackendAuthenticationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackendAuthenticationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackendAuthenticationConfigs.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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - - describe('listServerTlsPolicies', () => { - it('invokes listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listServerTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy) => { - 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.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServerTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[] = []; - const iterable = client.listServerTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServerTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IServerTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - - describe('listClientTlsPolicies', () => { - it('invokes listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listClientTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClientTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClientTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClientTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClientTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy) => { - 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.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listClientTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[] = []; - const iterable = client.listClientTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClientTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IClientTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes getIamPolicy with error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('listGatewaySecurityPolicies', () => { - it('invokes listGatewaySecurityPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - ]; - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listGatewaySecurityPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGatewaySecurityPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - ]; - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGatewaySecurityPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGatewaySecurityPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGatewaySecurityPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGatewaySecurityPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGatewaySecurityPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - ]; - client.descriptors.page.listGatewaySecurityPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGatewaySecurityPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy) => { - 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.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicies, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGatewaySecurityPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGatewaySecurityPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicies, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGatewaySecurityPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicy()), - ]; - client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[] = []; - const iterable = client.listGatewaySecurityPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGatewaySecurityPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGatewaySecurityPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + 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.IOperation[] = []; + 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('listGatewaySecurityPolicyRules', () => { - it('invokes listGatewaySecurityPolicyRules without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - ]; - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall(expectedResponse); - const [response] = await client.listGatewaySecurityPolicyRules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGatewaySecurityPolicyRules without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - ]; - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGatewaySecurityPolicyRules( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listGatewaySecurityPolicyRules with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGatewaySecurityPolicyRules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGatewaySecurityPolicyRules(request), expectedError); - const actualRequest = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGatewaySecurityPolicyRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listGatewaySecurityPolicyRulesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - ]; - client.descriptors.page.listGatewaySecurityPolicyRules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGatewaySecurityPolicyRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule) => { - 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.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicyRules, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listGatewaySecurityPolicyRulesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicyRules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGatewaySecurityPolicyRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGatewaySecurityPolicyRules, request)); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listGatewaySecurityPolicyRules without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.GatewaySecurityPolicyRule()), - ]; - client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[] = []; - const iterable = client.listGatewaySecurityPolicyRulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listGatewaySecurityPolicyRules with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListGatewaySecurityPolicyRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGatewaySecurityPolicyRulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IGatewaySecurityPolicyRule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGatewaySecurityPolicyRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('listUrlLists', () => { - it('invokes listUrlLists without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - ]; - client.innerApiCalls.listUrlLists = stubSimpleCall(expectedResponse); - const [response] = await client.listUrlLists(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listUrlLists without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - ]; - client.innerApiCalls.listUrlLists = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUrlLists( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IUrlList[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listUrlLists with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUrlLists = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUrlLists(request), expectedError); - const actualRequest = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUrlLists as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listUrlListsStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - ]; - client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUrlListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.UrlList[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.UrlList) => { - 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.listUrlLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUrlLists, request)); - assert( - (client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listUrlListsStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUrlLists.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUrlListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.UrlList[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.UrlList) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUrlLists, request)); - assert( - (client.descriptors.page.listUrlLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listUrlLists without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.UrlList()), - ]; - client.descriptors.page.listUrlLists.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IUrlList[] = []; - const iterable = client.listUrlListsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listUrlLists with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListUrlListsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUrlLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUrlListsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IUrlList[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUrlLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('listTlsInspectionPolicies', () => { - it('invokes listTlsInspectionPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - ]; - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listTlsInspectionPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listTlsInspectionPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - ]; - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTlsInspectionPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listTlsInspectionPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTlsInspectionPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTlsInspectionPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTlsInspectionPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listTlsInspectionPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - ]; - client.descriptors.page.listTlsInspectionPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTlsInspectionPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy) => { - 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.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTlsInspectionPolicies, request)); - assert( - (client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listTlsInspectionPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTlsInspectionPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTlsInspectionPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTlsInspectionPolicies, request)); - assert( - (client.descriptors.page.listTlsInspectionPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listTlsInspectionPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.TlsInspectionPolicy()), - ]; - client.descriptors.page.listTlsInspectionPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[] = []; - const iterable = client.listTlsInspectionPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listTlsInspectionPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListTlsInspectionPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTlsInspectionPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTlsInspectionPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ITlsInspectionPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTlsInspectionPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('listAuthzPolicies', () => { - it('invokes listAuthzPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - ]; - client.innerApiCalls.listAuthzPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAuthzPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAuthzPolicies without error using callback', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - ]; - client.innerApiCalls.listAuthzPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAuthzPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAuthzPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAuthzPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAuthzPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthzPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAuthzPoliciesStream without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - ]; - client.descriptors.page.listAuthzPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAuthzPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy) => { - 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.listAuthzPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthzPolicies, request)); - assert( - (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('invokes listAuthzPoliciesStream with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthzPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAuthzPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthzPolicies, request)); - assert( - (client.descriptors.page.listAuthzPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listAuthzPolicies without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.AuthzPolicy()), - ]; - client.descriptors.page.listAuthzPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[] = []; - const iterable = client.listAuthzPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('uses async iteration with listAuthzPolicies with error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListAuthzPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthzPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAuthzPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IAuthzPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthzPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - 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.IOperation[] = []; - 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 networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - 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('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new networksecurityModule.v1alpha1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_network_security_v1beta1.ts b/packages/google-cloud-networksecurity/test/gapic_network_security_v1beta1.ts index 4aaf4f00aa31..0a10ce44d25d 100644 --- a/packages/google-cloud-networksecurity/test/gapic_network_security_v1beta1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_network_security_v1beta1.ts @@ -19,3600 +19,4750 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as networksecurityModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1beta1.NetworkSecurityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); - 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 = networksecurityModule.v1beta1.NetworkSecurityClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = networksecurityModule.v1beta1.NetworkSecurityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1beta1.NetworkSecurityClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1beta1.NetworkSecurityClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1beta1.NetworkSecurityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = networksecurityModule.v1beta1.NetworkSecurityClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - await client.initialize(); - assert(client.networkSecurityStub); - }); - - it('has close method for the initialized client', done => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.networkSecurityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.networkSecurityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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('Common methods', () => { + it('has apiEndpoint', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); }); - describe('getAuthorizationPolicy', () => { - it('invokes getAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAuthorizationPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy() - ); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAuthorizationPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorizationPolicy with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAuthorizationPolicy with closed client', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAuthorizationPolicy(request), expectedError); - }); + it('has universeDomain', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getServerTlsPolicy', () => { - it('invokes getServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getServerTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy() - ); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServerTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerTlsPolicy with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServerTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServerTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServerTlsPolicy(request), expectedError); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networksecurityModule.v1beta1.NetworkSecurityClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networksecurityModule.v1beta1.NetworkSecurityClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); }); - describe('getClientTlsPolicy', () => { - it('invokes getClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getClientTlsPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy() - ); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getClientTlsPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getClientTlsPolicy with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getClientTlsPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + 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 networksecurityModule.v1beta1.NetworkSecurityClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 networksecurityModule.v1beta1.NetworkSecurityClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 networksecurityModule.v1beta1.NetworkSecurityClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes getClientTlsPolicy with closed client', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getClientTlsPolicy(request), expectedError); - }); + it('has port', () => { + const port = networksecurityModule.v1beta1.NetworkSecurityClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('createAuthorizationPolicy', () => { - it('invokes createAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient(); + assert(client); + }); - it('invokes createAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + fallback: true, + }); + assert(client); + }); - it('invokes createAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + await client.initialize(); + assert(client.networkSecurityStub); + }); - it('invokes createAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.networkSecurityStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('has close method for the non-initialized client', (done) => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.networkSecurityStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + 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()); }); - describe('updateAuthorizationPolicy', () => { - it('invokes updateAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + 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('getAuthorizationPolicy', () => { + it('invokes getAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getAuthorizationPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ); + client.innerApiCalls.getAuthorizationPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAuthorizationPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest() - ); - request.authorizationPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', ['authorizationPolicy', 'name']); - request.authorizationPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAuthorizationPolicy with closed client', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getAuthorizationPolicy(request), + expectedError, + ); + }); + }); + + describe('getServerTlsPolicy', () => { + it('invokes getServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getServerTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ); + client.innerApiCalls.getServerTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServerTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes getServerTlsPolicy with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServerTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getServerTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getServerTlsPolicy(request), expectedError); + }); + }); + + describe('getClientTlsPolicy', () => { + it('invokes getClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCall(expectedResponse); + const [response] = await client.getClientTlsPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAuthorizationPolicy', () => { - it('invokes deleteAuthorizationPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAuthorizationPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ); + client.innerApiCalls.getClientTlsPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getClientTlsPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAuthorizationPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getClientTlsPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAuthorizationPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getClientTlsPolicy with closed client', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.GetClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getClientTlsPolicy(request), expectedError); + }); + }); + + describe('createAuthorizationPolicy', () => { + it('invokes createAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAuthorizationPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAuthorizationPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAuthorizationPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAuthorizationPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateAuthorizationPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAuthorizationPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createServerTlsPolicy', () => { - it('invokes createServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAuthorizationPolicy', () => { + it('invokes updateAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest(), + ); + request.authorizationPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateAuthorizationPolicyRequest', + ['authorizationPolicy', 'name'], + ); + request.authorizationPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `authorization_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAuthorizationPolicy', () => { + it('invokes deleteAuthorizationPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAuthorizationPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteAuthorizationPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAuthorizationPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAuthorizationPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateServerTlsPolicy', () => { - it('invokes updateServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteAuthorizationPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAuthorizationPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteAuthorizationPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAuthorizationPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAuthorizationPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAuthorizationPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteAuthorizationPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest() - ); - request.serverTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', ['serverTlsPolicy', 'name']); - request.serverTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAuthorizationPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAuthorizationPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createServerTlsPolicy', () => { + it('invokes createServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateServerTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteServerTlsPolicy', () => { - it('invokes deleteServerTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteServerTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteServerTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServerTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateServerTlsPolicy', () => { + it('invokes updateServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteServerTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteServerTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteServerTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServerTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteServerTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest(), + ); + request.serverTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateServerTlsPolicyRequest', + ['serverTlsPolicy', 'name'], + ); + request.serverTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `server_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServerTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteServerTlsPolicy', () => { + it('invokes deleteServerTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteServerTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createClientTlsPolicy', () => { - it('invokes createClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteServerTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServerTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteServerTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteServerTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteServerTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServerTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteServerTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServerTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteServerTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteServerTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteServerTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteServerTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createClientTlsPolicy', () => { + it('invokes createClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateClientTlsPolicy', () => { - it('invokes updateClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.CreateClientTlsPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateClientTlsPolicy', () => { + it('invokes updateClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest() - ); - request.clientTlsPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', ['clientTlsPolicy', 'name']); - request.clientTlsPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes updateClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest(), + ); + request.clientTlsPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.UpdateClientTlsPolicyRequest', + ['clientTlsPolicy', 'name'], + ); + request.clientTlsPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `client_tls_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdateClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteClientTlsPolicy', () => { - it('invokes deleteClientTlsPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteClientTlsPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteClientTlsPolicy', () => { + it('invokes deleteClientTlsPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteClientTlsPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteClientTlsPolicy without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteClientTlsPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteClientTlsPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteClientTlsPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteClientTlsPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteClientTlsPolicy with call error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteClientTlsPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteClientTlsPolicy with call error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteClientTlsPolicy(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteClientTlsPolicy with LRO error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteClientTlsPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteClientTlsPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteClientTlsPolicy with LRO error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.DeleteClientTlsPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteClientTlsPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteClientTlsPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteClientTlsPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteClientTlsPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteClientTlsPolicyProgress without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteClientTlsPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeleteClientTlsPolicyProgress with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteClientTlsPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAuthorizationPolicies', () => { + it('invokes listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listAuthorizationPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClientTlsPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAuthorizationPolicies without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + ]; + client.innerApiCalls.listAuthorizationPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAuthorizationPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAuthorizationPolicies', () => { - it('invokes listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAuthorizationPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listAuthorizationPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAuthorizationPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAuthorizationPolicies without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - ]; - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAuthorizationPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPoliciesStream without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + ) => { + 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.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAuthorizationPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAuthorizationPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAuthorizationPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAuthorizationPoliciesStream with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAuthorizationPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAuthorizationPolicies, request), + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPoliciesStream without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy) => { - 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.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthorizationPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy(), + ), + ]; + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[] = + []; + const iterable = client.listAuthorizationPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAuthorizationPoliciesStream with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAuthorizationPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAuthorizationPolicies, request)); - assert( - (client.descriptors.page.listAuthorizationPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAuthorizationPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAuthorizationPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAuthorizationPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAuthorizationPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listServerTlsPolicies', () => { + it('invokes listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAuthorizationPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.AuthorizationPolicy()), - ]; - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[] = []; - const iterable = client.listAuthorizationPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listServerTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + ]; + client.innerApiCalls.listServerTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAuthorizationPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListAuthorizationPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizationPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAuthorizationPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1beta1.IAuthorizationPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAuthorizationPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listServerTlsPolicies', () => { - it('invokes listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listServerTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listServerTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - ]; - client.innerApiCalls.listServerTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + ) => { + 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.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServerTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServerTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy) => { - 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.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listServerTlsPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy(), + ), + ]; + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[] = + []; + const iterable = client.listServerTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listServerTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServerTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServerTlsPolicies, request)); - assert( - (client.descriptors.page.listServerTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listServerTlsPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServerTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServerTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServerTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listClientTlsPolicies', () => { + it('invokes listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listClientTlsPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listServerTlsPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ServerTlsPolicy()), - ]; - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[] = []; - const iterable = client.listServerTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listClientTlsPolicies without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + ]; + client.innerApiCalls.listClientTlsPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClientTlsPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServerTlsPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListServerTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServerTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServerTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1beta1.IServerTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServerTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listClientTlsPolicies', () => { - it('invokes listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listClientTlsPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClientTlsPolicies without error using callback', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - ]; - client.innerApiCalls.listClientTlsPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClientTlsPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClientTlsPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClientTlsPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClientTlsPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClientTlsPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listClientTlsPolicies(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClientTlsPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listClientTlsPoliciesStream without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy) => { - 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.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listClientTlsPoliciesStream without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + ) => { + 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.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listClientTlsPoliciesStream with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClientTlsPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClientTlsPolicies, request)); - assert( - (client.descriptors.page.listClientTlsPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listClientTlsPoliciesStream with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listClientTlsPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listClientTlsPolicies, request), + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listClientTlsPolicies without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy()), - ]; - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[] = []; - const iterable = client.listClientTlsPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClientTlsPolicies without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ClientTlsPolicy(), + ), + ]; + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[] = + []; + const iterable = client.listClientTlsPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listClientTlsPolicies with error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClientTlsPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClientTlsPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClientTlsPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClientTlsPolicies with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1beta1.ListClientTlsPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClientTlsPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClientTlsPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1beta1.IClientTlsPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listClientTlsPolicies + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listClientTlsPolicies + .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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + 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.IOperation[] = []; + 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 networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new networksecurityModule.v1beta1.NetworkSecurityClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_organization_address_group_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_organization_address_group_service_v1.ts index dee0a6238c8a..4d2710c002e1 100644 --- a/packages/google-cloud-networksecurity/test/gapic_organization_address_group_service_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_organization_address_group_service_v1.ts @@ -19,3803 +19,5902 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as organizationaddressgroupserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.OrganizationAddressGroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); - 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 = organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + it('has universeDomain', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + organizationaddressgroupserviceModule.v1 + .OrganizationAddressGroupServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + organizationaddressgroupserviceModule.v1 + .OrganizationAddressGroupServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has port', () => { - const port = organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with no option', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); - assert(client); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - fallback: true, - }); - assert(client); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationAddressGroupServiceStub, undefined); - await client.initialize(); - assert(client.organizationAddressGroupServiceStub); - }); + it('has port', () => { + const port = + organizationaddressgroupserviceModule.v1 + .OrganizationAddressGroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.organizationAddressGroupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient(); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationAddressGroupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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 initialize method and supports deferred initialization', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.organizationAddressGroupServiceStub, undefined); + await client.initialize(); + assert(client.organizationAddressGroupServiceStub); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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); + it('has close method for the initialized client', (done) => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.organizationAddressGroupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getAddressGroup', () => { - it('invokes getAddressGroup without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddressGroup() - ); - client.innerApiCalls.getAddressGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getAddressGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.organizationAddressGroupServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getAddressGroup without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddressGroup() - ); - client.innerApiCalls.getAddressGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAddressGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAddressGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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('invokes getAddressGroup with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAddressGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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('getAddressGroup', () => { + it('invokes getAddressGroup without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ); + client.innerApiCalls.getAddressGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getAddressGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAddressGroup with closed client', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAddressGroup(request), expectedError); - }); + it('invokes getAddressGroup without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ); + client.innerApiCalls.getAddressGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAddressGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.IAddressGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAddressGroup', () => { - it('invokes createAddressGroup without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAddressGroup with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAddressGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAddressGroup with closed client', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAddressGroup(request), expectedError); + }); + }); + + describe('createAddressGroup', () => { + it('invokes createAddressGroup without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAddressGroup without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAddressGroup with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateAddressGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAddressGroup with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAddressGroupProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createAddressGroup with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateAddressGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAddressGroupProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateAddressGroupProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateAddressGroup', () => { - it('invokes updateAddressGroup without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAddressGroupProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAddressGroup', () => { + it('invokes updateAddressGroup without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAddressGroup without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAddressGroup without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAddressGroup with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAddressGroup with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAddressGroup with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest() - ); - request.addressGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', ['addressGroup', 'name']); - request.addressGroup.name = defaultValue1; - const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAddressGroup with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateAddressGroupRequest(), + ); + request.addressGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateAddressGroupRequest', + ['addressGroup', 'name'], + ); + request.addressGroup.name = defaultValue1; + const expectedHeaderRequestParams = `address_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAddressGroupProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateAddressGroupProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateAddressGroupProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateAddressGroupProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addAddressGroupItems', () => { + it('invokes addAddressGroupItems without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addAddressGroupItems', () => { - it('invokes addAddressGroupItems without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.addAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addAddressGroupItems without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addAddressGroupItems with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.addAddressGroupItems(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addAddressGroupItems with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.addAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addAddressGroupItems with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.AddAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAddAddressGroupItemsProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkAddAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkAddAddressGroupItemsProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkAddAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkAddAddressGroupItemsProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkAddAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeAddressGroupItems', () => { + it('invokes removeAddressGroupItems without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAddAddressGroupItemsProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes removeAddressGroupItems without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeAddressGroupItems', () => { - it('invokes removeAddressGroupItems without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeAddressGroupItems with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.removeAddressGroupItems(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeAddressGroupItems without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeAddressGroupItems with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.removeAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeAddressGroupItems with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveAddressGroupItemsProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkRemoveAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes removeAddressGroupItems with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveAddressGroupItemsProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRemoveAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cloneAddressGroupItems', () => { + it('invokes cloneAddressGroupItems without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneAddressGroupItems = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cloneAddressGroupItems(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveAddressGroupItemsProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkRemoveAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes cloneAddressGroupItems without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cloneAddressGroupItems = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cloneAddressGroupItems( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.IAddressGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveAddressGroupItemsProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cloneAddressGroupItems with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.cloneAddressGroupItems(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cloneAddressGroupItems', () => { - it('invokes cloneAddressGroupItems without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(expectedResponse); - const [operation] = await client.cloneAddressGroupItems(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cloneAddressGroupItems with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cloneAddressGroupItems(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cloneAddressGroupItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cloneAddressGroupItems without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cloneAddressGroupItems( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCloneAddressGroupItemsProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCloneAddressGroupItemsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes cloneAddressGroupItems with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cloneAddressGroupItems(request), expectedError); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCloneAddressGroupItemsProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCloneAddressGroupItemsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAddressGroup', () => { + it('invokes deleteAddressGroup without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAddressGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAddressGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cloneAddressGroupItems with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cloneAddressGroupItems = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cloneAddressGroupItems(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cloneAddressGroupItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAddressGroup without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAddressGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAddressGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCloneAddressGroupItemsProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCloneAddressGroupItemsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteAddressGroup with call error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAddressGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAddressGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCloneAddressGroupItemsProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCloneAddressGroupItemsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteAddressGroup with LRO error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAddressGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAddressGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAddressGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAddressGroup', () => { - it('invokes deleteAddressGroup without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAddressGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAddressGroupProgress without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteAddressGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteAddressGroup without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAddressGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAddressGroupProgress with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAddressGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAddressGroups', () => { + it('invokes listAddressGroups without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.innerApiCalls.listAddressGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listAddressGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAddressGroup with call error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAddressGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAddressGroups without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.innerApiCalls.listAddressGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAddressGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.IAddressGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAddressGroup with LRO error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteAddressGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteAddressGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAddressGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAddressGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAddressGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAddressGroups with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAddressGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAddressGroups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAddressGroupProgress without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteAddressGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('invokes listAddressGroupsStream without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.descriptors.page.listAddressGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAddressGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes checkDeleteAddressGroupProgress with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAddressGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroups, request), + ); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listAddressGroups', () => { - it('invokes listAddressGroups without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.innerApiCalls.listAddressGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listAddressGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAddressGroups without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.innerApiCalls.listAddressGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAddressGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.IAddressGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listAddressGroupsStream with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAddressGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listAddressGroups with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAddressGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAddressGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroups, request), + ); + assert( + (client.descriptors.page.listAddressGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAddressGroupsStream without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.descriptors.page.listAddressGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAddressGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { - 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.listAddressGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroups, request)); - assert( - (client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAddressGroups without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.AddressGroup(), + ), + ]; + client.descriptors.page.listAddressGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = + []; + const iterable = client.listAddressGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroups.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAddressGroupsStream with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAddressGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.AddressGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.AddressGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroups, request)); - assert( - (client.descriptors.page.listAddressGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAddressGroups with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAddressGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroups.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listAddressGroupReferences', () => { + it('invokes listAddressGroupReferences without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.innerApiCalls.listAddressGroupReferences = + stubSimpleCall(expectedResponse); + const [response] = await client.listAddressGroupReferences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAddressGroups without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.AddressGroup()), - ]; - client.descriptors.page.listAddressGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = []; - const iterable = client.listAddressGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listAddressGroupReferences without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.innerApiCalls.listAddressGroupReferences = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAddressGroupReferences( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAddressGroups with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAddressGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.IAddressGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAddressGroupReferences', () => { - it('invokes listAddressGroupReferences without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.innerApiCalls.listAddressGroupReferences = stubSimpleCall(expectedResponse); - const [response] = await client.listAddressGroupReferences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAddressGroupReferences with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAddressGroupReferences = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listAddressGroupReferences(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAddressGroupReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAddressGroupReferences without error using callback', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.innerApiCalls.listAddressGroupReferences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAddressGroupReferences( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listAddressGroupReferencesStream without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.descriptors.page.listAddressGroupReferences.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAddressGroupReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listAddressGroupReferences with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAddressGroupReferences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAddressGroupReferences(request), expectedError); - const actualRequest = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAddressGroupReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroupReferences, request), + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listAddressGroupReferencesStream without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.descriptors.page.listAddressGroupReferences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAddressGroupReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference) => { - 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.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroupReferences, request)); - assert( - (client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listAddressGroupReferencesStream with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroupReferences.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAddressGroupReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listAddressGroupReferencesStream with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroupReferences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAddressGroupReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAddressGroupReferences, request)); - assert( - (client.descriptors.page.listAddressGroupReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listAddressGroupReferences, request), + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listAddressGroupReferences without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference()), - ]; - client.descriptors.page.listAddressGroupReferences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = []; - const iterable = client.listAddressGroupReferencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAddressGroupReferences without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference(), + ), + ]; + client.descriptors.page.listAddressGroupReferences.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = + []; + const iterable = client.listAddressGroupReferencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listAddressGroupReferences with error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', ['addressGroup']); - request.addressGroup = defaultValue1; - const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAddressGroupReferences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAddressGroupReferencesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAddressGroupReferences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAddressGroupReferences with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest', + ['addressGroup'], + ); + request.addressGroup = defaultValue1; + const expectedHeaderRequestParams = `address_group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAddressGroupReferences.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAddressGroupReferencesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.IAddressGroupReference[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAddressGroupReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listAddressGroupReferences + .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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + 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.IOperation[] = []; + 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 organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new organizationaddressgroupserviceModule.v1.OrganizationAddressGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1.ts index acae0eadf59c..acbb1b68788e 100644 --- a/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1.ts @@ -19,3915 +19,6097 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as organizationsecurityprofilegroupserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.OrganizationSecurityProfileGroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); - 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 = organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + organizationsecurityprofilegroupserviceModule.v1 + .OrganizationSecurityProfileGroupServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + organizationsecurityprofilegroupserviceModule.v1 + .OrganizationSecurityProfileGroupServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with no option', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); - assert(client); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - fallback: true, - }); - assert(client); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has initialize method and supports deferred initialization', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationSecurityProfileGroupServiceStub, undefined); - await client.initialize(); - assert(client.organizationSecurityProfileGroupServiceStub); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('has close method for the initialized client', done => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.organizationSecurityProfileGroupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = + organizationsecurityprofilegroupserviceModule.v1 + .OrganizationSecurityProfileGroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationSecurityProfileGroupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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('should create a client with gRPC fallback', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.organizationSecurityProfileGroupServiceStub, + undefined, + ); + await client.initialize(); + assert(client.organizationSecurityProfileGroupServiceStub); }); - describe('getSecurityProfileGroup', () => { - it('invokes getSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.SecurityProfileGroup() - ); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getSecurityProfileGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.organizationSecurityProfileGroupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.SecurityProfileGroup() - ); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecurityProfileGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.organizationSecurityProfileGroupServiceStub, + undefined, + ); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getSecurityProfileGroup with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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('invokes getSecurityProfileGroup with closed client', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSecurityProfileGroup(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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('getSecurityProfileGroup', () => { + it('invokes getSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfileGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSecurityProfile', () => { - it('invokes getSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.SecurityProfile() - ); - client.innerApiCalls.getSecurityProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getSecurityProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.SecurityProfile() - ); - client.innerApiCalls.getSecurityProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecurityProfile( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ISecurityProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfileGroup with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSecurityProfile with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecurityProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfileGroup with closed client', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + }); + }); + + describe('getSecurityProfile', () => { + it('invokes getSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSecurityProfile with closed client', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSecurityProfile(request), expectedError); - }); + it('invokes getSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISecurityProfile | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSecurityProfileGroup', () => { - it('invokes createSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfile with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfile = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSecurityProfile(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfile with closed client', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSecurityProfile(request), expectedError); + }); + }); + + describe('createSecurityProfileGroup', () => { + it('invokes createSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateSecurityProfileGroup', () => { - it('invokes updateSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfileGroup', () => { + it('invokes updateSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfileGroup', () => { + it('invokes deleteSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSecurityProfileGroup', () => { - it('invokes deleteSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSecurityProfile', () => { + it('invokes createSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSecurityProfile', () => { - it('invokes createSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfile', () => { + it('invokes updateSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSecurityProfile', () => { - it('invokes updateSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfile', () => { + it('invokes deleteSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSecurityProfile', () => { - it('invokes deleteSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSecurityProfileGroups', () => { + it('invokes listSecurityProfileGroups without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfileGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSecurityProfileGroups without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfileGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSecurityProfileGroups with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listSecurityProfileGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('invokes listSecurityProfileGroupsStream without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes checkDeleteSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listSecurityProfileGroups', () => { - it('invokes listSecurityProfileGroups without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - ]; - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listSecurityProfileGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listSecurityProfileGroupsStream with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listSecurityProfileGroups without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - ]; - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecurityProfileGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSecurityProfileGroups with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecurityProfileGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listSecurityProfileGroupsStream without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - ]; - client.descriptors.page.listSecurityProfileGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecurityProfileGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup) => { - 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.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfileGroups, request)); - assert( - (client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfileGroups without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = + []; + const iterable = client.listSecurityProfileGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listSecurityProfileGroupsStream with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfileGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecurityProfileGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfileGroups, request)); - assert( - (client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfileGroups with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfileGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listSecurityProfiles', () => { + it('invokes listSecurityProfiles without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSecurityProfileGroups without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfileGroup()), - ]; - client.descriptors.page.listSecurityProfileGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = []; - const iterable = client.listSecurityProfileGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listSecurityProfiles without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfiles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ISecurityProfile[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSecurityProfileGroups with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfileGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecurityProfileGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfiles with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfiles = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSecurityProfiles(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSecurityProfiles', () => { - it('invokes listSecurityProfiles without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - ]; - client.innerApiCalls.listSecurityProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listSecurityProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listSecurityProfilesStream without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfile, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listSecurityProfiles without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - ]; - client.innerApiCalls.listSecurityProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecurityProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1.ISecurityProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSecurityProfiles with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecurityProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecurityProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listSecurityProfilesStream with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfile, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listSecurityProfilesStream without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - ]; - client.descriptors.page.listSecurityProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecurityProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.SecurityProfile) => { - 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.listSecurityProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfiles, request)); - assert( - (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSecurityProfilesStream with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecurityProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1.SecurityProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfiles, request)); - assert( - (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSecurityProfiles without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1.SecurityProfile()), - ]; - client.descriptors.page.listSecurityProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = []; - const iterable = client.listSecurityProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfiles without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = + []; + const iterable = client.listSecurityProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSecurityProfiles with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecurityProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfiles with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + 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.IOperation[] = []; + 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 organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organization', async () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organization', async () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocation', async () => { + const fakePath = '/rendered/path/organizationLocation'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationLocationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationLocationPath', () => { + const result = client.organizationLocationPath( + 'organizationValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationName', () => { + const result = + client.matchOrganizationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationName', () => { + const result = + client.matchLocationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocation', async () => { - const fakePath = "/rendered/path/organizationLocation"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationPath', () => { - const result = client.organizationLocationPath("organizationValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationName', () => { - const result = client.matchOrganizationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationName', () => { - const result = client.matchLocationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationAddressGroup', async () => { - const fakePath = "/rendered/path/organizationLocationAddressGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationAddressGroupPath', () => { - const result = client.organizationLocationAddressGroupPath("organizationValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationAddressGroupName', () => { - const result = client.matchLocationFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromOrganizationLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.organizationLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationAddressGroup', async () => { - const fakePath = "/rendered/path/projectLocationAddressGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - address_group: "addressGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationAddressGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAddressGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAddressGroupPath', () => { - const result = client.projectLocationAddressGroupPath("projectValue", "locationValue", "addressGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAddressGroupName', () => { - const result = client.matchProjectFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAddressGroupName', () => { - const result = client.matchLocationFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAddressGroupFromProjectLocationAddressGroupName', () => { - const result = client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); - assert.strictEqual(result, "addressGroupValue"); - assert((client.pathTemplates.projectLocationAddressGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1alpha1.ts index f93d3f610264..29e87d4b0684 100644 --- a/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_organization_security_profile_group_service_v1alpha1.ts @@ -19,4053 +19,6159 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as organizationsecurityprofilegroupserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.OrganizationSecurityProfileGroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); - 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 = organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationSecurityProfileGroupServiceStub, undefined); - await client.initialize(); - assert(client.organizationSecurityProfileGroupServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.organizationSecurityProfileGroupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.organizationSecurityProfileGroupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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 universeDomain', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + organizationsecurityprofilegroupserviceModule.v1alpha1 + .OrganizationSecurityProfileGroupServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + organizationsecurityprofilegroupserviceModule.v1alpha1 + .OrganizationSecurityProfileGroupServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); }); - describe('getSecurityProfileGroup', () => { - it('invokes getSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup() - ); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getSecurityProfileGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('invokes getSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup() + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { universeDomain: 'configured.example.com' }, ); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecurityProfileGroup( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('invokes getSecurityProfileGroup with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = + organizationsecurityprofilegroupserviceModule.v1alpha1 + .OrganizationSecurityProfileGroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes getSecurityProfileGroup with closed client', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSecurityProfileGroup(request), expectedError); - }); + it('should create a client with no option', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient(); + assert(client); }); - describe('getSecurityProfile', () => { - it('invokes getSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile() - ); - client.innerApiCalls.getSecurityProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getSecurityProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('invokes getSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile() - ); - client.innerApiCalls.getSecurityProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecurityProfile( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.organizationSecurityProfileGroupServiceStub, + undefined, + ); + await client.initialize(); + assert(client.organizationSecurityProfileGroupServiceStub); + }); - it('invokes getSecurityProfile with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecurityProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.organizationSecurityProfileGroupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getSecurityProfile with closed client', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSecurityProfile(request), expectedError); + it('has close method for the non-initialized client', (done) => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.organizationSecurityProfileGroupServiceStub, + undefined, + ); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createSecurityProfileGroup', () => { - it('invokes createSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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('invokes createSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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('getSecurityProfileGroup', () => { + it('invokes getSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfileGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfileGroup with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getSecurityProfileGroup with closed client', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + }); + }); + + describe('getSecurityProfile', () => { + it('invokes getSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSecurityProfileGroup', () => { - it('invokes updateSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfile with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfile = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSecurityProfile(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSecurityProfile with closed client', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSecurityProfile(request), expectedError); + }); + }); + + describe('createSecurityProfileGroup', () => { + it('invokes createSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest() - ); - request.securityProfileGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', ['securityProfileGroup', 'name']); - request.securityProfileGroup.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteSecurityProfileGroup', () => { - it('invokes deleteSecurityProfileGroup without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSecurityProfileGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfileGroup', () => { + it('invokes updateSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecurityProfileGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSecurityProfileGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfileGroup with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSecurityProfileGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfileGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSecurityProfileGroupProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSecurityProfileGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteSecurityProfileGroupProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSecurityProfileGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfileGroup', () => { + it('invokes deleteSecurityProfileGroup without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSecurityProfile', () => { - it('invokes createSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfileGroup with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileGroupProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteSecurityProfileGroupProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSecurityProfile', () => { + it('invokes createSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSecurityProfile', () => { - it('invokes updateSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest() - ); - request.securityProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', ['securityProfile', 'name']); - request.securityProfile.name = defaultValue1; - const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfile', () => { + it('invokes updateSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdateSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSecurityProfile', () => { - it('invokes deleteSecurityProfile without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSecurityProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfile without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecurityProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteSecurityProfile with call error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSecurityProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfile', () => { + it('invokes deleteSecurityProfile without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSecurityProfile with LRO error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSecurityProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSecurityProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSecurityProfile without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSecurityProfileProgress without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSecurityProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteSecurityProfile with call error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSecurityProfileProgress with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSecurityProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteSecurityProfile with LRO error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSecurityProfileGroups', () => { - it('invokes listSecurityProfileGroups without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - ]; - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listSecurityProfileGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileProgress without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes listSecurityProfileGroups without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - ]; - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecurityProfileGroups( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSecurityProfileProgress with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSecurityProfileGroups', () => { + it('invokes listSecurityProfileGroups without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfileGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfileGroups with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecurityProfileGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfileGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSecurityProfileGroups without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfileGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfileGroupsStream without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - ]; - client.descriptors.page.listSecurityProfileGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecurityProfileGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup) => { - 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.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfileGroups, request)); - assert( - (client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfileGroups with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listSecurityProfileGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfileGroupsStream with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfileGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecurityProfileGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfileGroups, request)); - assert( - (client.descriptors.page.listSecurityProfileGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfileGroupsStream without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + ) => { + 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.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listSecurityProfileGroups without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup()), - ]; - client.descriptors.page.listSecurityProfileGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[] = []; - const iterable = client.listSecurityProfileGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfileGroupsStream with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listSecurityProfileGroups with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfileGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecurityProfileGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfileGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfileGroups without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[] = + []; + const iterable = client.listSecurityProfileGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listSecurityProfiles', () => { - it('invokes listSecurityProfiles without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - ]; - client.innerApiCalls.listSecurityProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listSecurityProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listSecurityProfileGroups with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfileGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfileGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listSecurityProfiles', () => { + it('invokes listSecurityProfiles without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfiles without error using callback', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - ]; - client.innerApiCalls.listSecurityProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecurityProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSecurityProfiles without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfiles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfiles with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecurityProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecurityProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSecurityProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSecurityProfiles with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfiles = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSecurityProfiles(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSecurityProfilesStream without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - ]; - client.descriptors.page.listSecurityProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecurityProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile) => { - 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.listSecurityProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfiles, request)); - assert( - (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfilesStream without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + ) => { + 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.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSecurityProfilesStream with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecurityProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecurityProfiles, request)); - assert( - (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSecurityProfilesStream with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SecurityProfile, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSecurityProfiles without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile()), - ]; - client.descriptors.page.listSecurityProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[] = []; - const iterable = client.listSecurityProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfiles without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[] = + []; + const iterable = client.listSecurityProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSecurityProfiles with error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSecurityProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecurityProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSecurityProfiles with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ISecurityProfile[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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)); - }); + it('invokes setIamPolicy with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); } - 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + 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.IOperation[] = []; + 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 organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organization', async () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organization', async () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocation', async () => { - const fakePath = "/rendered/path/organizationLocation"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationPath', () => { - const result = client.organizationLocationPath("organizationValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationName', () => { - const result = client.matchOrganizationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationName', () => { - const result = client.matchLocationFromOrganizationLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocation', async () => { + const fakePath = '/rendered/path/organizationLocation'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationLocationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationLocationPath', () => { + const result = client.organizationLocationPath( + 'organizationValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationName', () => { + const result = + client.matchOrganizationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationName', () => { + const result = + client.matchLocationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new organizationsecurityprofilegroupserviceModule.v1alpha1.OrganizationSecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_s_s_e_gateway_service_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_s_s_e_gateway_service_v1alpha1.ts index 39522bc6b803..06de048ef65e 100644 --- a/packages/google-cloud-networksecurity/test/gapic_s_s_e_gateway_service_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_s_s_e_gateway_service_v1alpha1.ts @@ -19,3587 +19,5305 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as ssegatewayserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.SSEGatewayServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); - 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 = ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.port; - assert(port); - assert(typeof port === 'number'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with no option', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - fallback: true, - }); - assert(client); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has initialize method and supports deferred initialization', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sSEGatewayServiceStub, undefined); - await client.initialize(); - assert(client.sSEGatewayServiceStub); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has close method for the initialized client', done => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sSEGatewayServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the non-initialized client', done => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sSEGatewayServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = + ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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('should create a client with no option', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient(); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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); + it('should create a client with gRPC fallback', () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + fallback: true, }); + assert(client); }); - describe('getPartnerSSEGateway', () => { - it('invokes getPartnerSSEGateway without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway() - ); - client.innerApiCalls.getPartnerSseGateway = stubSimpleCall(expectedResponse); - const [response] = await client.getPartnerSSEGateway(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPartnerSSEGateway without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway() - ); - client.innerApiCalls.getPartnerSseGateway = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPartnerSSEGateway( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPartnerSSEGateway with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPartnerSseGateway = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPartnerSSEGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPartnerSSEGateway with closed client', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPartnerSSEGateway(request), expectedError); - }); - }); - - describe('getSSEGatewayReference', () => { - it('invokes getSSEGatewayReference without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference() - ); - client.innerApiCalls.getSseGatewayReference = stubSimpleCall(expectedResponse); - const [response] = await client.getSSEGatewayReference(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSSEGatewayReference without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference() - ); - client.innerApiCalls.getSseGatewayReference = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSSEGatewayReference( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSSEGatewayReference with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSseGatewayReference = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSSEGatewayReference(request), expectedError); - const actualRequest = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSseGatewayReference as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSSEGatewayReference with closed client', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSSEGatewayReference(request), expectedError); - }); - }); - - describe('createPartnerSSEGateway', () => { - it('invokes createPartnerSSEGateway without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPartnerSseGateway = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPartnerSSEGateway(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPartnerSSEGateway without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPartnerSseGateway = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPartnerSSEGateway( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPartnerSSEGateway with call error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPartnerSseGateway = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPartnerSSEGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPartnerSSEGateway with LRO error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPartnerSseGateway = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPartnerSSEGateway(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePartnerSSEGatewayProgress without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreatePartnerSSEGatewayProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePartnerSSEGatewayProgress with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePartnerSSEGatewayProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + it('has initialize method and supports deferred initialization', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sSEGatewayServiceStub, undefined); + await client.initialize(); + assert(client.sSEGatewayServiceStub); }); - describe('deletePartnerSSEGateway', () => { - it('invokes deletePartnerSSEGateway without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePartnerSSEGateway(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePartnerSSEGateway without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePartnerSSEGateway( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePartnerSSEGateway with call error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePartnerSSEGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePartnerSSEGateway with LRO error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePartnerSSEGateway(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePartnerSSEGatewayProgress without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeletePartnerSSEGatewayProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePartnerSSEGatewayProgress with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePartnerSSEGatewayProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + it('has close method for the initialized client', (done) => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sSEGatewayServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('updatePartnerSSEGateway', () => { - it('invokes updatePartnerSSEGateway without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest() - ); - request.partnerSseGateway ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', ['partnerSseGateway', 'name']); - request.partnerSseGateway.name = defaultValue1; - const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePartnerSSEGateway(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePartnerSSEGateway without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest() - ); - request.partnerSseGateway ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', ['partnerSseGateway', 'name']); - request.partnerSseGateway.name = defaultValue1; - const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePartnerSSEGateway( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePartnerSSEGateway with call error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest() - ); - request.partnerSseGateway ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', ['partnerSseGateway', 'name']); - request.partnerSseGateway.name = defaultValue1; - const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePartnerSSEGateway(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updatePartnerSSEGateway with LRO error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest() - ); - request.partnerSseGateway ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', ['partnerSseGateway', 'name']); - request.partnerSseGateway.name = defaultValue1; - const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePartnerSSEGateway(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePartnerSseGateway as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdatePartnerSSEGatewayProgress without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkUpdatePartnerSSEGatewayProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdatePartnerSSEGatewayProgress with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('has close method for the non-initialized client', (done) => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sSEGatewayServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePartnerSSEGatewayProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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()); }); - describe('listPartnerSSEGateways', () => { - it('invokes listPartnerSSEGateways without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - ]; - client.innerApiCalls.listPartnerSseGateways = stubSimpleCall(expectedResponse); - const [response] = await client.listPartnerSSEGateways(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSEGateways without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - ]; - client.innerApiCalls.listPartnerSseGateways = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPartnerSSEGateways( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSEGateways with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPartnerSseGateways = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPartnerSSEGateways(request), expectedError); - const actualRequest = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseGateways as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSEGatewaysStream without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - ]; - client.descriptors.page.listPartnerSSEGateways.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPartnerSSEGatewaysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway) => { - 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.listPartnerSSEGateways.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPartnerSseGateways, request)); - assert( - (client.descriptors.page.listPartnerSSEGateways.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPartnerSSEGatewaysStream with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPartnerSSEGateways.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPartnerSSEGatewaysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPartnerSSEGateways.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPartnerSseGateways, request)); - assert( - (client.descriptors.page.listPartnerSSEGateways.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPartnerSSEGateways without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway()), - ]; - client.descriptors.page.listPartnerSSEGateways.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[] = []; - const iterable = client.listPartnerSSEGatewaysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPartnerSSEGateways.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPartnerSSEGateways.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPartnerSSEGateways with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPartnerSSEGateways.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPartnerSSEGatewaysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPartnerSSEGateways.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPartnerSSEGateways.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSSEGatewayReferences', () => { - it('invokes listSSEGatewayReferences without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - ]; - client.innerApiCalls.listSseGatewayReferences = stubSimpleCall(expectedResponse); - const [response] = await client.listSSEGatewayReferences(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSSEGatewayReferences without error using callback', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - ]; - client.innerApiCalls.listSseGatewayReferences = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSSEGatewayReferences( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSSEGatewayReferences with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSseGatewayReferences = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSSEGatewayReferences(request), expectedError); - const actualRequest = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSseGatewayReferences as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSSEGatewayReferencesStream without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - ]; - client.descriptors.page.listSSEGatewayReferences.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSSEGatewayReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference) => { - 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.listSSEGatewayReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSseGatewayReferences, request)); - assert( - (client.descriptors.page.listSSEGatewayReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSSEGatewayReferencesStream with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSSEGatewayReferences.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSSEGatewayReferencesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSSEGatewayReferences.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSseGatewayReferences, request)); - assert( - (client.descriptors.page.listSSEGatewayReferences.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSSEGatewayReferences without error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference()), - ]; - client.descriptors.page.listSSEGatewayReferences.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[] = []; - const iterable = client.listSSEGatewayReferencesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSSEGatewayReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSSEGatewayReferences.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSSEGatewayReferences with error', async () => { - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSSEGatewayReferences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSSEGatewayReferencesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSSEGatewayReferences.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSSEGatewayReferences.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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - 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.IOperation[] = []; - 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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('getPartnerSSEGateway', () => { + it('invokes getPartnerSSEGateway without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ); + client.innerApiCalls.getPartnerSseGateway = + stubSimpleCall(expectedResponse); + const [response] = await client.getPartnerSSEGateway(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { + it('invokes getPartnerSSEGateway without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ); + client.innerApiCalls.getPartnerSseGateway = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPartnerSSEGateway( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getPartnerSSEGateway with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPartnerSseGateway = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getPartnerSSEGateway(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getPartnerSSEGateway with closed client', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getPartnerSSEGateway(request), expectedError); + }); + }); + + describe('getSSEGatewayReference', () => { + it('invokes getSSEGatewayReference without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ); + client.innerApiCalls.getSseGatewayReference = + stubSimpleCall(expectedResponse); + const [response] = await client.getSSEGatewayReference(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getSSEGatewayReference without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ); + client.innerApiCalls.getSseGatewayReference = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSSEGatewayReference( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getSSEGatewayReference with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSseGatewayReference = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getSSEGatewayReference(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSseGatewayReference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getSSEGatewayReference with closed client', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSSEGatewayReferenceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getSSEGatewayReference(request), + expectedError, + ); + }); + }); + + describe('createPartnerSSEGateway', () => { + it('invokes createPartnerSSEGateway without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPartnerSseGateway = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createPartnerSSEGateway(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createPartnerSSEGateway without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPartnerSseGateway = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPartnerSSEGateway( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createPartnerSSEGateway with call error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPartnerSseGateway = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createPartnerSSEGateway(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createPartnerSSEGateway with LRO error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSEGatewayRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPartnerSseGateway = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createPartnerSSEGateway(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes checkCreatePartnerSSEGatewayProgress without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreatePartnerSSEGatewayProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkCreatePartnerSSEGatewayProgress with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreatePartnerSSEGatewayProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deletePartnerSSEGateway', () => { + it('invokes deletePartnerSSEGateway without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePartnerSseGateway = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePartnerSSEGateway(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deletePartnerSSEGateway without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePartnerSseGateway = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePartnerSSEGateway( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deletePartnerSSEGateway with call error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deletePartnerSSEGateway(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes deletePartnerSSEGateway with LRO error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSEGatewayRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePartnerSseGateway = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deletePartnerSSEGateway(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkDeletePartnerSSEGatewayProgress without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeletePartnerSSEGatewayProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkDeletePartnerSSEGatewayProgress with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeletePartnerSSEGatewayProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updatePartnerSSEGateway', () => { + it('invokes updatePartnerSSEGateway without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest(), + ); + request.partnerSseGateway ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', + ['partnerSseGateway', 'name'], + ); + request.partnerSseGateway.name = defaultValue1; + const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePartnerSseGateway = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePartnerSSEGateway(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updatePartnerSSEGateway without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest(), + ); + request.partnerSseGateway ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', + ['partnerSseGateway', 'name'], + ); + request.partnerSseGateway.name = defaultValue1; + const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePartnerSseGateway = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePartnerSSEGateway( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updatePartnerSSEGateway with call error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest(), + ); + request.partnerSseGateway ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', + ['partnerSseGateway', 'name'], + ); + request.partnerSseGateway.name = defaultValue1; + const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updatePartnerSSEGateway(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updatePartnerSSEGateway with LRO error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest(), + ); + request.partnerSseGateway ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.UpdatePartnerSSEGatewayRequest', + ['partnerSseGateway', 'name'], + ); + request.partnerSseGateway.name = defaultValue1; + const expectedHeaderRequestParams = `partner_sse_gateway.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePartnerSseGateway = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updatePartnerSSEGateway(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePartnerSseGateway as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkUpdatePartnerSSEGatewayProgress without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkUpdatePartnerSSEGatewayProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes checkUpdatePartnerSSEGatewayProgress with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdatePartnerSSEGatewayProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listPartnerSSEGateways', () => { + it('invokes listPartnerSSEGateways without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + ]; + client.innerApiCalls.listPartnerSseGateways = + stubSimpleCall(expectedResponse); + const [response] = await client.listPartnerSSEGateways(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listPartnerSSEGateways without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + ]; + client.innerApiCalls.listPartnerSseGateways = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPartnerSSEGateways( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listPartnerSSEGateways with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPartnerSseGateways = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listPartnerSSEGateways(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseGateways as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listPartnerSSEGatewaysStream without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + ]; + client.descriptors.page.listPartnerSSEGateways.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPartnerSSEGatewaysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + ) => { + 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.listPartnerSSEGateways + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listPartnerSseGateways, request), + ); + assert( + ( + client.descriptors.page.listPartnerSSEGateways + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listPartnerSSEGatewaysStream with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPartnerSSEGateways.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPartnerSSEGatewaysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listPartnerSSEGateways + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listPartnerSseGateways, request), + ); + assert( + ( + client.descriptors.page.listPartnerSSEGateways + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('uses async iteration with listPartnerSSEGateways without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSEGateway(), + ), + ]; + client.descriptors.page.listPartnerSSEGateways.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[] = + []; + const iterable = client.listPartnerSSEGatewaysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPartnerSSEGateways + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPartnerSSEGateways + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listPartnerSSEGateways with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSEGatewaysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPartnerSSEGateways.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPartnerSSEGatewaysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSEGateway[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPartnerSSEGateways + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPartnerSSEGateways + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listSSEGatewayReferences', () => { + it('invokes listSSEGatewayReferences without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + ]; + client.innerApiCalls.listSseGatewayReferences = + stubSimpleCall(expectedResponse); + const [response] = await client.listSSEGatewayReferences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listSSEGatewayReferences without error using callback', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + ]; + client.innerApiCalls.listSseGatewayReferences = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSSEGatewayReferences( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listSSEGatewayReferences with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSseGatewayReferences = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listSSEGatewayReferences(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSseGatewayReferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listSSEGatewayReferencesStream without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + ]; + client.descriptors.page.listSSEGatewayReferences.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSSEGatewayReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference, + ) => { + 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.listSSEGatewayReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSseGatewayReferences, request), + ); + assert( + ( + client.descriptors.page.listSSEGatewayReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listSSEGatewayReferencesStream with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSSEGatewayReferences.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSSEGatewayReferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSSEGatewayReferences + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSseGatewayReferences, request), + ); + assert( + ( + client.descriptors.page.listSSEGatewayReferences + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listSSEGatewayReferences without error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SSEGatewayReference(), + ), + ]; + client.descriptors.page.listSSEGatewayReferences.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[] = + []; + const iterable = client.listSSEGatewayReferencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSSEGatewayReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSSEGatewayReferences + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listSSEGatewayReferences with error', async () => { + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSSEGatewayReferencesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSSEGatewayReferences.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSSEGatewayReferencesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ISSEGatewayReference[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSSEGatewayReferences + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSSEGatewayReferences + .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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - describe('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + 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.IOperation[] = []; + 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 ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new ssegatewayserviceModule.v1alpha1.SSEGatewayServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1.ts new file mode 100644 index 000000000000..63ebe1be987d --- /dev/null +++ b/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1.ts @@ -0,0 +1,5263 @@ +// Copyright 2026 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 sserealmserviceModule 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.SSERealmServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient(); + 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 = + sserealmserviceModule.v1.SSERealmServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sserealmserviceModule.v1.SSERealmServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1.SSERealmServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1.SSERealmServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 sserealmserviceModule.v1.SSERealmServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sserealmserviceModule.v1.SSERealmServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sSERealmServiceStub, undefined); + await client.initialize(); + assert(client.sSERealmServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sSERealmServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sSERealmServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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('getSACRealm', () => { + it('invokes getSACRealm without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ); + client.innerApiCalls.getSacRealm = stubSimpleCall(expectedResponse); + const [response] = await client.getSACRealm(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ); + client.innerApiCalls.getSacRealm = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSACRealm( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISACRealm | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACRealm with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSacRealm = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACRealm with closed client', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSACRealm(request), expectedError); + }); + }); + + describe('getSACAttachment', () => { + it('invokes getSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ); + client.innerApiCalls.getSacAttachment = stubSimpleCall(expectedResponse); + const [response] = await client.getSACAttachment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ); + client.innerApiCalls.getSacAttachment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSACAttachment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISACAttachment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACAttachment with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSacAttachment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSACAttachment with closed client', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSACAttachment(request), expectedError); + }); + }); + + describe('createSACRealm', () => { + it('invokes createSACRealm without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSACRealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSACRealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISACRealm, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACRealm with call error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACRealm with LRO error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSACRealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSACRealmProgress without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateSACRealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSACRealmProgress with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSACRealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSACRealm', () => { + it('invokes deleteSACRealm without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSACRealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSACRealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACRealm with call error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACRealm with LRO error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSACRealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSACRealmProgress without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteSACRealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSACRealmProgress with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSACRealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSACAttachment', () => { + it('invokes createSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacAttachment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSACAttachment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacAttachment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSACAttachment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISACAttachment, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACAttachment with call error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacAttachment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSACAttachment with LRO error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacAttachment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSACAttachment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSACAttachmentProgress without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateSACAttachmentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSACAttachmentProgress with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSACAttachmentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSACAttachment', () => { + it('invokes deleteSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacAttachment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSACAttachment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacAttachment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSACAttachment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACAttachment with call error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacAttachment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSACAttachment with LRO error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacAttachment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSACAttachment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSACAttachmentProgress without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteSACAttachmentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSACAttachmentProgress with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSACAttachmentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSACRealms', () => { + it('invokes listSACRealms without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + ]; + client.innerApiCalls.listSacRealms = stubSimpleCall(expectedResponse); + const [response] = await client.listSACRealms(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACRealms without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + ]; + client.innerApiCalls.listSacRealms = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSACRealms( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISACRealm[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACRealms with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSacRealms = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSACRealms(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACRealmsStream without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + ]; + client.descriptors.page.listSACRealms.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSACRealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SACRealm[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.SACRealm) => { + 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.listSACRealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacRealms, request), + ); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listSACRealmsStream with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACRealms.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSACRealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SACRealm[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.SACRealm) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacRealms, request), + ); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSACRealms without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACRealm(), + ), + ]; + client.descriptors.page.listSACRealms.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISACRealm[] = []; + const iterable = client.listSACRealmsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACRealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSACRealms with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACRealms.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSACRealmsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISACRealm[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACRealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listSACAttachments', () => { + it('invokes listSACAttachments without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + ]; + client.innerApiCalls.listSacAttachments = + stubSimpleCall(expectedResponse); + const [response] = await client.listSACAttachments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACAttachments without error using callback', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + ]; + client.innerApiCalls.listSacAttachments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSACAttachments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ISACAttachment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACAttachments with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSacAttachments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSACAttachments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSACAttachmentsStream without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + ]; + client.descriptors.page.listSACAttachments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSACAttachmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SACAttachment[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.SACAttachment) => { + 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.listSACAttachments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacAttachments, request), + ); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listSACAttachmentsStream with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACAttachments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSACAttachmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SACAttachment[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1.SACAttachment) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacAttachments, request), + ); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSACAttachments without error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SACAttachment(), + ), + ]; + client.descriptors.page.listSACAttachments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISACAttachment[] = + []; + const iterable = client.listSACAttachmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACAttachments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSACAttachments with error', async () => { + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACAttachments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSACAttachmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISACAttachment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACAttachments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACAttachments.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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + 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.IOperation[] = []; + 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 sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new sserealmserviceModule.v1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1alpha1.ts b/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1alpha1.ts index aec5731b6e6a..6a7148d0189d 100644 --- a/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1alpha1.ts +++ b/packages/google-cloud-networksecurity/test/gapic_s_s_e_realm_service_v1alpha1.ts @@ -19,4398 +19,6178 @@ 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 { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sserealmserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +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(); +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; + 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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('v1alpha1.SSERealmServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); - 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 = sserealmserviceModule.v1alpha1.SSERealmServiceClient.servicePath; - assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sserealmserviceModule.v1alpha1.SSERealmServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = sserealmserviceModule.v1alpha1.SSERealmServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sSERealmServiceStub, undefined); - await client.initialize(); - assert(client.sSERealmServiceStub); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); - it('has close method for the initialized client', done => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sSERealmServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has universeDomain', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has close method for the non-initialized client', done => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sSERealmServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sserealmserviceModule.v1alpha1.SSERealmServiceClient.servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sserealmserviceModule.v1alpha1.SSERealmServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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); + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); }); - describe('getSACRealm', () => { - it('invokes getSACRealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SACRealm() - ); - client.innerApiCalls.getSacRealm = stubSimpleCall(expectedResponse); - const [response] = await client.getSACRealm(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = sserealmserviceModule.v1alpha1.SSERealmServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes getSACRealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SACRealm() - ); - client.innerApiCalls.getSacRealm = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSACRealm( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISACRealm|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient(); + assert(client); + }); - it('invokes getSACRealm with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSacRealm = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSACRealm(request), expectedError); - const actualRequest = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getSACRealm with closed client', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSACRealm(request), expectedError); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sSERealmServiceStub, undefined); + await client.initialize(); + assert(client.sSERealmServiceStub); }); - describe('getSACAttachment', () => { - it('invokes getSACAttachment without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SACAttachment() - ); - client.innerApiCalls.getSacAttachment = stubSimpleCall(expectedResponse); - const [response] = await client.getSACAttachment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sSERealmServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getSACAttachment without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.SACAttachment() - ); - client.innerApiCalls.getSacAttachment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSACAttachment( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sSERealmServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getSACAttachment with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSacAttachment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSACAttachment(request), expectedError); - const actualRequest = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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('invokes getSACAttachment with closed client', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSACAttachment(request), expectedError); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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('getSACRealm', () => { + it('invokes getSACRealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ); + client.innerApiCalls.getSacRealm = stubSimpleCall(expectedResponse); + const [response] = await client.getSACRealm(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getPartnerSSERealm', () => { - it('invokes getPartnerSSERealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm() - ); - client.innerApiCalls.getPartnerSseRealm = stubSimpleCall(expectedResponse); - const [response] = await client.getPartnerSSERealm(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ); + client.innerApiCalls.getSacRealm = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSACRealm( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ISACRealm | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPartnerSSERealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm() - ); - client.innerApiCalls.getPartnerSseRealm = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPartnerSSERealm( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSACRealm with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSacRealm = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPartnerSSERealm with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPartnerSseRealm = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPartnerSSERealm(request), expectedError); - const actualRequest = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSACRealm with closed client', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSACRealm(request), expectedError); + }); + }); + + describe('getSACAttachment', () => { + it('invokes getSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ); + client.innerApiCalls.getSacAttachment = stubSimpleCall(expectedResponse); + const [response] = await client.getSACAttachment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPartnerSSERealm with closed client', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPartnerSSERealm(request), expectedError); - }); + it('invokes getSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ); + client.innerApiCalls.getSacAttachment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSACAttachment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSACRealm', () => { - it('invokes createSACRealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSacRealm = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSACRealm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSACAttachment with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSacAttachment = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACRealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSacRealm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSACRealm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSACAttachment with closed client', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSACAttachment(request), expectedError); + }); + }); + + describe('getPartnerSSERealm', () => { + it('invokes getPartnerSSERealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ); + client.innerApiCalls.getPartnerSseRealm = + stubSimpleCall(expectedResponse); + const [response] = await client.getPartnerSSERealm(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACRealm with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSacRealm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSACRealm(request), expectedError); - const actualRequest = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPartnerSSERealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ); + client.innerApiCalls.getPartnerSseRealm = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPartnerSSERealm( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACRealm with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSacRealm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSACRealm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPartnerSSERealm with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPartnerSseRealm = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getPartnerSSERealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSACRealmProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSACRealmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getPartnerSSERealm with closed client', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.GetPartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getPartnerSSERealm(request), expectedError); + }); + }); + + describe('createSACRealm', () => { + it('invokes createSACRealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSACRealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSACRealmProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSACRealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACRealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSACRealmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createSACRealm with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSACRealm', () => { - it('invokes deleteSACRealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSacRealm = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSACRealm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSACRealm with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACRealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSACRealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSACRealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSacRealm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSACRealm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSACRealmProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateSACRealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteSACRealm with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSacRealm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSACRealm(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSACRealmProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSACRealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSACRealm', () => { + it('invokes deleteSACRealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSACRealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSACRealm with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSacRealm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSACRealm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSACRealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSACRealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSACRealmProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSACRealmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteSACRealm with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSACRealm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSACRealmProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteSACRealm with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACRealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSACRealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSACRealmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteSACRealmProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteSACRealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createSACAttachment', () => { - it('invokes createSACAttachment without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSacAttachment = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSACAttachment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSACRealmProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSACRealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSACAttachment', () => { + it('invokes createSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacAttachment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSACAttachment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACAttachment without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSacAttachment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSACAttachment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSacAttachment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSACAttachment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.ISACAttachment, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACAttachment with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSacAttachment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSACAttachment(request), expectedError); - const actualRequest = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSACAttachment with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacAttachment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSACAttachment with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSacAttachment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSACAttachment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSACAttachment with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreateSACAttachmentRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSacAttachment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSACAttachment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSACAttachmentProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreateSACAttachmentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateSACAttachmentProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreateSACAttachmentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateSACAttachmentProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkCreateSACAttachmentProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSACAttachmentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSACAttachment', () => { + it('invokes deleteSACAttachment without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacAttachment = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSACAttachment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSACAttachmentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteSACAttachment without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSacAttachment = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSACAttachment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSACAttachment', () => { - it('invokes deleteSACAttachment without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSacAttachment = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSACAttachment(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSACAttachment with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacAttachment = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSACAttachment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSACAttachment without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSacAttachment = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSACAttachment( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSACAttachment with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSacAttachment = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSACAttachment(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSacAttachment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSACAttachment with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSacAttachment = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSACAttachment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSACAttachmentProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeleteSACAttachmentProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteSACAttachment with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeleteSACAttachmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSacAttachment = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSACAttachment(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSacAttachment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSACAttachmentProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSACAttachmentProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createPartnerSSERealm', () => { + it('invokes createPartnerSSERealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPartnerSseRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createPartnerSSERealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSACAttachmentProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeleteSACAttachmentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createPartnerSSERealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPartnerSseRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPartnerSSERealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSACAttachmentProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createPartnerSSERealm with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPartnerSseRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createPartnerSSERealm(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSACAttachmentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createPartnerSSERealm with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPartnerSseRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createPartnerSSERealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createPartnerSSERealm', () => { - it('invokes createPartnerSSERealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPartnerSseRealm = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPartnerSSERealm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreatePartnerSSERealmProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkCreatePartnerSSERealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createPartnerSSERealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPartnerSseRealm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPartnerSSERealm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreatePartnerSSERealmProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreatePartnerSSERealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deletePartnerSSERealm', () => { + it('invokes deletePartnerSSERealm without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePartnerSseRealm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePartnerSSERealm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPartnerSSERealm with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPartnerSseRealm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPartnerSSERealm(request), expectedError); - const actualRequest = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deletePartnerSSERealm without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePartnerSseRealm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePartnerSSERealm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPartnerSSERealm with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.CreatePartnerSSERealmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPartnerSseRealm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPartnerSSERealm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deletePartnerSSERealm with call error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deletePartnerSSERealm(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreatePartnerSSERealmProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkCreatePartnerSSERealmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deletePartnerSSERealm with LRO error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deletePartnerSSERealm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePartnerSseRealm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreatePartnerSSERealmProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeletePartnerSSERealmProgress without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.checkDeletePartnerSSERealmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePartnerSSERealmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeletePartnerSSERealmProgress with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeletePartnerSSERealmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSACRealms', () => { + it('invokes listSACRealms without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + ]; + client.innerApiCalls.listSacRealms = stubSimpleCall(expectedResponse); + const [response] = await client.listSACRealms(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deletePartnerSSERealm', () => { - it('invokes deletePartnerSSERealm without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePartnerSSERealm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACRealms without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + ]; + client.innerApiCalls.listSacRealms = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSACRealms( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ISACRealm[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePartnerSSERealm without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePartnerSSERealm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACRealms with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSacRealms = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSACRealms(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePartnerSSERealm with call error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePartnerSSERealm(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACRealmsStream without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + ]; + client.descriptors.page.listSACRealms.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSACRealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SACRealm[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1alpha1.SACRealm) => { + 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.listSACRealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacRealms, request), + ); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes deletePartnerSSERealm with LRO error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.DeletePartnerSSERealmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePartnerSseRealm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePartnerSSERealm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePartnerSseRealm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACRealmsStream with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACRealms.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSACRealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SACRealm[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networksecurity.v1alpha1.SACRealm) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacRealms, request), + ); + assert( + (client.descriptors.page.listSACRealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkDeletePartnerSSERealmProgress without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.checkDeletePartnerSSERealmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listSACRealms without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACRealm(), + ), + ]; + client.descriptors.page.listSACRealms.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ISACRealm[] = + []; + const iterable = client.listSACRealmsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACRealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkDeletePartnerSSERealmProgress with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('uses async iteration with listSACRealms with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACRealms.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSACRealmsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ISACRealm[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACRealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listSACAttachments', () => { + it('invokes listSACAttachments without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + ]; + client.innerApiCalls.listSacAttachments = + stubSimpleCall(expectedResponse); + const [response] = await client.listSACAttachments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePartnerSSERealmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listSACAttachments without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + ]; + client.innerApiCalls.listSacAttachments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSACAttachments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSACRealms', () => { - it('invokes listSACRealms without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - ]; - client.innerApiCalls.listSacRealms = stubSimpleCall(expectedResponse); - const [response] = await client.listSACRealms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACAttachments with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSacAttachments = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSACAttachments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSacAttachments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSACRealms without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - ]; - client.innerApiCalls.listSacRealms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSACRealms( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISACRealm[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACAttachmentsStream without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + ]; + client.descriptors.page.listSACAttachments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSACAttachmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SACAttachment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SACAttachment, + ) => { + 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.listSACAttachments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacAttachments, request), + ); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACRealms with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSacRealms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSACRealms(request), expectedError); - const actualRequest = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSACAttachmentsStream with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACAttachments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSACAttachmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.SACAttachment[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.SACAttachment, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSacAttachments, request), + ); + assert( + (client.descriptors.page.listSACAttachments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACRealmsStream without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - ]; - client.descriptors.page.listSACRealms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSACRealmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SACRealm[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SACRealm) => { - 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.listSACRealms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSacRealms, request)); - assert( - (client.descriptors.page.listSACRealms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSACAttachments without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.SACAttachment(), + ), + ]; + client.descriptors.page.listSACAttachments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[] = + []; + const iterable = client.listSACAttachmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACAttachments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACRealmsStream with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSACRealms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSACRealmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SACRealm[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SACRealm) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSACRealms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSacRealms, request)); - assert( - (client.descriptors.page.listSACRealms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSACAttachments with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSACAttachments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSACAttachmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSACAttachments.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listPartnerSSERealms', () => { + it('invokes listPartnerSSERealms without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + ]; + client.innerApiCalls.listPartnerSseRealms = + stubSimpleCall(expectedResponse); + const [response] = await client.listPartnerSSERealms(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSACRealms without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACRealm()), - ]; - client.descriptors.page.listSACRealms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ISACRealm[] = []; - const iterable = client.listSACRealmsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listPartnerSSERealms without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + ]; + client.innerApiCalls.listPartnerSseRealms = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPartnerSSERealms( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSACRealms with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACRealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSACRealms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSACRealmsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ISACRealm[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSACRealms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listPartnerSSERealms with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPartnerSseRealms = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listPartnerSSERealms(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPartnerSseRealms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSACAttachments', () => { - it('invokes listSACAttachments without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - ]; - client.innerApiCalls.listSacAttachments = stubSimpleCall(expectedResponse); - const [response] = await client.listSACAttachments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPartnerSSERealmsStream without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + ]; + client.descriptors.page.listPartnerSSERealms.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPartnerSSERealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm, + ) => { + 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.listPartnerSSERealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPartnerSseRealms, request), + ); + assert( + (client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACAttachments without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - ]; - client.innerApiCalls.listSacAttachments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSACAttachments( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPartnerSSERealmsStream with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPartnerSSERealms.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPartnerSSERealmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPartnerSseRealms, request), + ); + assert( + (client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACAttachments with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSacAttachments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSACAttachments(request), expectedError); - const actualRequest = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSacAttachments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listPartnerSSERealms without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm(), + ), + ]; + client.descriptors.page.listPartnerSSERealms.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[] = + []; + const iterable = client.listPartnerSSERealmsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSACAttachmentsStream without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - ]; - client.descriptors.page.listSACAttachments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSACAttachmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SACAttachment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SACAttachment) => { - 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.listSACAttachments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSacAttachments, request)); - assert( - (client.descriptors.page.listSACAttachments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSACAttachmentsStream with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSACAttachments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSACAttachmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.SACAttachment[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.SACAttachment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSACAttachments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSacAttachments, request)); - assert( - (client.descriptors.page.listSACAttachments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSACAttachments without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.SACAttachment()), - ]; - client.descriptors.page.listSACAttachments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[] = []; - const iterable = client.listSACAttachmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSACAttachments with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListSACAttachmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSACAttachments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSACAttachmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.ISACAttachment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSACAttachments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPartnerSSERealms with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPartnerSSERealms.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPartnerSSERealmsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - - describe('listPartnerSSERealms', () => { - it('invokes listPartnerSSERealms without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - ]; - client.innerApiCalls.listPartnerSseRealms = stubSimpleCall(expectedResponse); - const [response] = await client.listPartnerSSERealms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSERealms without error using callback', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - ]; - client.innerApiCalls.listPartnerSseRealms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPartnerSSERealms( - request, - (err?: Error|null, result?: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSERealms with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPartnerSseRealms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPartnerSSERealms(request), expectedError); - const actualRequest = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPartnerSseRealms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPartnerSSERealmsStream without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - ]; - client.descriptors.page.listPartnerSSERealms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPartnerSSERealmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm) => { - 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.listPartnerSSERealms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPartnerSseRealms, request)); - assert( - (client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPartnerSSERealmsStream with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPartnerSSERealms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPartnerSSERealmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm[] = []; - stream.on('data', (response: protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPartnerSseRealms, request)); - assert( - (client.descriptors.page.listPartnerSSERealms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPartnerSSERealms without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - generateSampleMessage(new protos.google.cloud.networksecurity.v1alpha1.PartnerSSERealm()), - ]; - client.descriptors.page.listPartnerSSERealms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[] = []; - const iterable = client.listPartnerSSERealmsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPartnerSSERealms with error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.networksecurity.v1alpha1.ListPartnerSSERealmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPartnerSSERealms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPartnerSSERealmsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networksecurity.v1alpha1.IPartnerSSERealm[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPartnerSSERealms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPartnerSSERealms.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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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)); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 - ) - ); - }); + it('invokes setIamPolicy with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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); - } - }).catch(err => {throw err}); - }); - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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)); - }); + it('invokes testIamPermissions with error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - 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.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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); } - 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + 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.IOperation[] = []; + 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 sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('authorizationPolicy', async () => { - const fakePath = "/rendered/path/authorizationPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authorization_policy: "authorizationPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authorizationPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authorizationPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authorizationPolicyPath', () => { - const result = client.authorizationPolicyPath("projectValue", "locationValue", "authorizationPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authorizationPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthorizationPolicyName', () => { - const result = client.matchProjectFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthorizationPolicyName', () => { - const result = client.matchLocationFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { - const result = client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); - assert.strictEqual(result, "authorizationPolicyValue"); - assert((client.pathTemplates.authorizationPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('authzPolicy', async () => { - const fakePath = "/rendered/path/authzPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - authz_policy: "authzPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.authzPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.authzPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('authzPolicyPath', () => { - const result = client.authzPolicyPath("projectValue", "locationValue", "authzPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAuthzPolicyName', () => { - const result = client.matchProjectFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAuthzPolicyName', () => { - const result = client.matchLocationFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAuthzPolicyFromAuthzPolicyName', () => { - const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); - assert.strictEqual(result, "authzPolicyValue"); - assert((client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backendAuthenticationConfig', async () => { - const fakePath = "/rendered/path/backendAuthenticationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backend_authentication_config: "backendAuthenticationConfigValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backendAuthenticationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backendAuthenticationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backendAuthenticationConfigPath', () => { - const result = client.backendAuthenticationConfigPath("projectValue", "locationValue", "backendAuthenticationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackendAuthenticationConfigName', () => { - const result = client.matchProjectFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackendAuthenticationConfigName', () => { - const result = client.matchLocationFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { - const result = client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName(fakePath); - assert.strictEqual(result, "backendAuthenticationConfigValue"); - assert((client.pathTemplates.backendAuthenticationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clientTlsPolicy', async () => { - const fakePath = "/rendered/path/clientTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - client_tls_policy: "clientTlsPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clientTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clientTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clientTlsPolicyPath', () => { - const result = client.clientTlsPolicyPath("projectValue", "locationValue", "clientTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClientTlsPolicyName', () => { - const result = client.matchProjectFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClientTlsPolicyName', () => { - const result = client.matchLocationFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClientTlsPolicyFromClientTlsPolicyName', () => { - const result = client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); - assert.strictEqual(result, "clientTlsPolicyValue"); - assert((client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsThreatDetector', async () => { - const fakePath = "/rendered/path/dnsThreatDetector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dns_threat_detector: "dnsThreatDetectorValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsThreatDetectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsThreatDetectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsThreatDetectorPath', () => { - const result = client.dnsThreatDetectorPath("projectValue", "locationValue", "dnsThreatDetectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsThreatDetectorName', () => { - const result = client.matchProjectFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsThreatDetectorName', () => { - const result = client.matchLocationFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { - const result = client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); - assert.strictEqual(result, "dnsThreatDetectorValue"); - assert((client.pathTemplates.dnsThreatDetectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('firewallEndpointAssociation', async () => { - const fakePath = "/rendered/path/firewallEndpointAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint_association: "firewallEndpointAssociationValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.firewallEndpointAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.firewallEndpointAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('firewallEndpointAssociationPath', () => { - const result = client.firewallEndpointAssociationPath("projectValue", "locationValue", "firewallEndpointAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFirewallEndpointAssociationName', () => { - const result = client.matchProjectFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFirewallEndpointAssociationName', () => { - const result = client.matchLocationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { - const result = client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName(fakePath); - assert.strictEqual(result, "firewallEndpointAssociationValue"); - assert((client.pathTemplates.firewallEndpointAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicy', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyPath', () => { - const result = client.gatewaySecurityPolicyPath("projectValue", "locationValue", "gatewaySecurityPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('gatewaySecurityPolicyRule', async () => { - const fakePath = "/rendered/path/gatewaySecurityPolicyRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - gateway_security_policy: "gatewaySecurityPolicyValue", - rule: "ruleValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('gatewaySecurityPolicyRulePath', () => { - const result = client.gatewaySecurityPolicyRulePath("projectValue", "locationValue", "gatewaySecurityPolicyValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "gatewaySecurityPolicyValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromGatewaySecurityPolicyRuleName', () => { - const result = client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeployment', async () => { - const fakePath = "/rendered/path/interceptDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment: "interceptDeploymentValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentPath', () => { - const result = client.interceptDeploymentPath("projectValue", "locationValue", "interceptDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentName', () => { - const result = client.matchProjectFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentName', () => { - const result = client.matchLocationFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentFromInterceptDeploymentName', () => { - const result = client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); - assert.strictEqual(result, "interceptDeploymentValue"); - assert((client.pathTemplates.interceptDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptDeploymentGroup', async () => { - const fakePath = "/rendered/path/interceptDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_deployment_group: "interceptDeploymentGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptDeploymentGroupPath', () => { - const result = client.interceptDeploymentGroupPath("projectValue", "locationValue", "interceptDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptDeploymentGroupName', () => { - const result = client.matchProjectFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptDeploymentGroupName', () => { - const result = client.matchLocationFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { - const result = client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName(fakePath); - assert.strictEqual(result, "interceptDeploymentGroupValue"); - assert((client.pathTemplates.interceptDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroup', async () => { - const fakePath = "/rendered/path/interceptEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group: "interceptEndpointGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupPath', () => { - const result = client.interceptEndpointGroupPath("projectValue", "locationValue", "interceptEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupName', () => { - const result = client.matchProjectFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupName', () => { - const result = client.matchLocationFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { - const result = client.matchInterceptEndpointGroupFromInterceptEndpointGroupName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupValue"); - assert((client.pathTemplates.interceptEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interceptEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/interceptEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intercept_endpoint_group_association: "interceptEndpointGroupAssociationValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interceptEndpointGroupAssociationPath', () => { - const result = client.interceptEndpointGroupAssociationPath("projectValue", "locationValue", "interceptEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchProjectFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchLocationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { - const result = client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "interceptEndpointGroupAssociationValue"); - assert((client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('mirroringDeployment', async () => { - const fakePath = "/rendered/path/mirroringDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment: "mirroringDeploymentValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentPath', () => { - const result = client.mirroringDeploymentPath("projectValue", "locationValue", "mirroringDeploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentName', () => { - const result = client.matchProjectFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentName', () => { - const result = client.matchLocationFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentFromMirroringDeploymentName', () => { - const result = client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); - assert.strictEqual(result, "mirroringDeploymentValue"); - assert((client.pathTemplates.mirroringDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringDeploymentGroup', async () => { - const fakePath = "/rendered/path/mirroringDeploymentGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_deployment_group: "mirroringDeploymentGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringDeploymentGroupPath', () => { - const result = client.mirroringDeploymentGroupPath("projectValue", "locationValue", "mirroringDeploymentGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringDeploymentGroupName', () => { - const result = client.matchProjectFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringDeploymentGroupName', () => { - const result = client.matchLocationFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { - const result = client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName(fakePath); - assert.strictEqual(result, "mirroringDeploymentGroupValue"); - assert((client.pathTemplates.mirroringDeploymentGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroup', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group: "mirroringEndpointGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupPath', () => { - const result = client.mirroringEndpointGroupPath("projectValue", "locationValue", "mirroringEndpointGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupName', () => { - const result = client.matchProjectFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupName', () => { - const result = client.matchLocationFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { - const result = client.matchMirroringEndpointGroupFromMirroringEndpointGroupName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupValue"); - assert((client.pathTemplates.mirroringEndpointGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('mirroringEndpointGroupAssociation', async () => { - const fakePath = "/rendered/path/mirroringEndpointGroupAssociation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - mirroring_endpoint_group_association: "mirroringEndpointGroupAssociationValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('mirroringEndpointGroupAssociationPath', () => { - const result = client.mirroringEndpointGroupAssociationPath("projectValue", "locationValue", "mirroringEndpointGroupAssociationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchProjectFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchLocationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { - const result = client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName(fakePath); - assert.strictEqual(result, "mirroringEndpointGroupAssociationValue"); - assert((client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/organizationLocationFirewallEndpoints"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationFirewallEndpointsPath', () => { - const result = client.organizationLocationFirewallEndpointsPath("organizationValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchOrganizationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfile"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfilePath', () => { - const result = client.organizationLocationSecurityProfilePath("organizationValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromOrganizationLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/organizationLocationSecurityProfileGroup"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationSecurityProfileGroupPath', () => { - const result = client.organizationLocationSecurityProfileGroupPath("organizationValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSEGateway', async () => { - const fakePath = "/rendered/path/partnerSSEGateway"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_gateway: "partnerSseGatewayValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSEGatewayPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSEGatewayPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSEGatewayPath', () => { - const result = client.partnerSSEGatewayPath("projectValue", "locationValue", "partnerSseGatewayValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSEGatewayName', () => { - const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSEGatewayName', () => { - const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { - const result = client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); - assert.strictEqual(result, "partnerSseGatewayValue"); - assert((client.pathTemplates.partnerSSEGatewayPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('partnerSSERealm', async () => { - const fakePath = "/rendered/path/partnerSSERealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - partner_sse_realm: "partnerSseRealmValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.partnerSSERealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.partnerSSERealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('partnerSSERealmPath', () => { - const result = client.partnerSSERealmPath("projectValue", "locationValue", "partnerSseRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPartnerSSERealmName', () => { - const result = client.matchProjectFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPartnerSSERealmName', () => { - const result = client.matchLocationFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPartnerSseRealmFromPartnerSSERealmName', () => { - const result = client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); - assert.strictEqual(result, "partnerSseRealmValue"); - assert((client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await 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('projectLocationFirewallEndpoints', async () => { - const fakePath = "/rendered/path/projectLocationFirewallEndpoints"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - firewall_endpoint: "firewallEndpointValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationFirewallEndpointsPath', () => { - const result = client.projectLocationFirewallEndpointsPath("projectValue", "locationValue", "firewallEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchLocationFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { - const result = client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName(fakePath); - assert.strictEqual(result, "firewallEndpointValue"); - assert((client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationSecurityProfile', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile: "securityProfileValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfilePath', () => { - const result = client.projectLocationSecurityProfilePath("projectValue", "locationValue", "securityProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationSecurityProfileName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { - const result = client.matchSecurityProfileFromProjectLocationSecurityProfileName(fakePath); - assert.strictEqual(result, "securityProfileValue"); - assert((client.pathTemplates.projectLocationSecurityProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectLocationSecurityProfileGroup', async () => { - const fakePath = "/rendered/path/projectLocationSecurityProfileGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_profile_group: "securityProfileGroupValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationSecurityProfileGroupPath', () => { - const result = client.projectLocationSecurityProfileGroupPath("projectValue", "locationValue", "securityProfileGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchProjectFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchLocationFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { - const result = client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName(fakePath); - assert.strictEqual(result, "securityProfileGroupValue"); - assert((client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACAttachment', async () => { - const fakePath = "/rendered/path/sACAttachment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_attachment: "sacAttachmentValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACAttachmentPath', () => { - const result = client.sACAttachmentPath("projectValue", "locationValue", "sacAttachmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSACAttachmentName', () => { - const result = client.matchProjectFromSACAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACAttachmentName', () => { - const result = client.matchLocationFromSACAttachmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSacAttachmentFromSACAttachmentName', () => { - const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); - assert.strictEqual(result, "sacAttachmentValue"); - assert((client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sACRealm', async () => { - const fakePath = "/rendered/path/sACRealm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sac_realm: "sacRealmValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sACRealmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sACRealmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sACRealmPath', () => { - const result = client.sACRealmPath("projectValue", "locationValue", "sacRealmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sACRealmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchProjectFromSACRealmName', () => { - const result = client.matchProjectFromSACRealmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSACRealmName', () => { - const result = client.matchLocationFromSACRealmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSacRealmFromSACRealmName', () => { - const result = client.matchSacRealmFromSACRealmName(fakePath); - assert.strictEqual(result, "sacRealmValue"); - assert((client.pathTemplates.sACRealmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('sSEGatewayReference', async () => { - const fakePath = "/rendered/path/sSEGatewayReference"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - sse_gateway_reference: "sseGatewayReferenceValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sSEGatewayReferencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sSEGatewayReferencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sSEGatewayReferencePath', () => { - const result = client.sSEGatewayReferencePath("projectValue", "locationValue", "sseGatewayReferenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSSEGatewayReferenceName', () => { - const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSSEGatewayReferenceName', () => { - const result = client.matchLocationFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { - const result = client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); - assert.strictEqual(result, "sseGatewayReferenceValue"); - assert((client.pathTemplates.sSEGatewayReferencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serverTlsPolicy', async () => { - const fakePath = "/rendered/path/serverTlsPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - server_tls_policy: "serverTlsPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serverTlsPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serverTlsPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serverTlsPolicyPath', () => { - const result = client.serverTlsPolicyPath("projectValue", "locationValue", "serverTlsPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('partnerSSEGateway', async () => { + const fakePath = '/rendered/path/partnerSSEGateway'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_gateway: 'partnerSseGatewayValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSEGatewayPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSEGatewayPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSEGatewayPath', () => { + const result = client.partnerSSEGatewayPath( + 'projectValue', + 'locationValue', + 'partnerSseGatewayValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSEGatewayName', () => { + const result = client.matchProjectFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSEGatewayName', () => { + const result = client.matchLocationFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseGatewayFromPartnerSSEGatewayName', () => { + const result = + client.matchPartnerSseGatewayFromPartnerSSEGatewayName(fakePath); + assert.strictEqual(result, 'partnerSseGatewayValue'); + assert( + ( + client.pathTemplates.partnerSSEGatewayPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromServerTlsPolicyName', () => { - const result = client.matchProjectFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('partnerSSERealm', async () => { + const fakePath = '/rendered/path/partnerSSERealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + partner_sse_realm: 'partnerSseRealmValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.partnerSSERealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.partnerSSERealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('partnerSSERealmPath', () => { + const result = client.partnerSSERealmPath( + 'projectValue', + 'locationValue', + 'partnerSseRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPartnerSSERealmName', () => { + const result = client.matchProjectFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPartnerSSERealmName', () => { + const result = client.matchLocationFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPartnerSseRealmFromPartnerSSERealmName', () => { + const result = + client.matchPartnerSseRealmFromPartnerSSERealmName(fakePath); + assert.strictEqual(result, 'partnerSseRealmValue'); + assert( + (client.pathTemplates.partnerSSERealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromServerTlsPolicyName', () => { - const result = client.matchLocationFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await 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), + ); + }); + }); - it('matchServerTlsPolicyFromServerTlsPolicyName', () => { - const result = client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); - assert.strictEqual(result, "serverTlsPolicyValue"); - assert((client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('tlsInspectionPolicy', async () => { - const fakePath = "/rendered/path/tlsInspectionPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tls_inspection_policy: "tlsInspectionPolicyValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.tlsInspectionPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tlsInspectionPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tlsInspectionPolicyPath', () => { - const result = client.tlsInspectionPolicyPath("projectValue", "locationValue", "tlsInspectionPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromTlsInspectionPolicyName', () => { - const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromTlsInspectionPolicyName', () => { - const result = client.matchLocationFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { - const result = client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); - assert.strictEqual(result, "tlsInspectionPolicyValue"); - assert((client.pathTemplates.tlsInspectionPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('urlList', async () => { - const fakePath = "/rendered/path/urlList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - url_list: "urlListValue", - }; - const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.urlListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.urlListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('urlListPath', () => { - const result = client.urlListPath("projectValue", "locationValue", "urlListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.urlListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('sSEGatewayReference', async () => { + const fakePath = '/rendered/path/sSEGatewayReference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sse_gateway_reference: 'sseGatewayReferenceValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sSEGatewayReferencePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sSEGatewayReferencePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sSEGatewayReferencePath', () => { + const result = client.sSEGatewayReferencePath( + 'projectValue', + 'locationValue', + 'sseGatewayReferenceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSSEGatewayReferenceName', () => { + const result = client.matchProjectFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSSEGatewayReferenceName', () => { + const result = + client.matchLocationFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSseGatewayReferenceFromSSEGatewayReferenceName', () => { + const result = + client.matchSseGatewayReferenceFromSSEGatewayReferenceName(fakePath); + assert.strictEqual(result, 'sseGatewayReferenceValue'); + assert( + ( + client.pathTemplates.sSEGatewayReferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromUrlListName', () => { - const result = client.matchProjectFromUrlListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromUrlListName', () => { - const result = client.matchLocationFromUrlListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUrlListFromUrlListName', () => { - const result = client.matchUrlListFromUrlListName(fakePath); - assert.strictEqual(result, "urlListValue"); - assert((client.pathTemplates.urlListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = new sserealmserviceModule.v1alpha1.SSERealmServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-networksecurity/test/gapic_security_profile_group_service_v1.ts b/packages/google-cloud-networksecurity/test/gapic_security_profile_group_service_v1.ts new file mode 100644 index 000000000000..9222193c26eb --- /dev/null +++ b/packages/google-cloud-networksecurity/test/gapic_security_profile_group_service_v1.ts @@ -0,0 +1,6109 @@ +// Copyright 2026 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 securityprofilegroupserviceModule 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.SecurityProfileGroupServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient(); + 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 = + securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient + .servicePath; + assert.strictEqual(servicePath, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'networksecurity.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networksecurity.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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networksecurity.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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); + + it('has port', () => { + const port = + securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.securityProfileGroupServiceStub, undefined); + await client.initialize(); + assert(client.securityProfileGroupServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.securityProfileGroupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.securityProfileGroupServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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('getSecurityProfileGroup', () => { + it('invokes getSecurityProfileGroup without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfileGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfileGroup without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ); + client.innerApiCalls.getSecurityProfileGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfileGroup with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfileGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfileGroup with closed client', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getSecurityProfileGroup(request), + expectedError, + ); + }); + }); + + describe('getSecurityProfile', () => { + it('invokes getSecurityProfile without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.getSecurityProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfile without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ); + client.innerApiCalls.getSecurityProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecurityProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networksecurity.v1.ISecurityProfile | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfile with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecurityProfile = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSecurityProfile(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSecurityProfile with closed client', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.GetSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.GetSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSecurityProfile(request), expectedError); + }); + }); + + describe('createSecurityProfileGroup', () => { + it('invokes createSecurityProfileGroup without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfileGroup without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfileGroup with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfileGroup with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSecurityProfileGroupProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSecurityProfileGroupProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfileGroup', () => { + it('invokes updateSecurityProfileGroup without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfileGroup without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfileGroup, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfileGroup with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfileGroup with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest(), + ); + request.securityProfileGroup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileGroupRequest', + ['securityProfileGroup', 'name'], + ); + request.securityProfileGroup.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile_group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSecurityProfileGroupProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSecurityProfileGroupProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfileGroup', () => { + it('invokes deleteSecurityProfileGroup without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfileGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfileGroup without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfileGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfileGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfileGroup with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfileGroup(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfileGroup with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfileGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfileGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfileGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSecurityProfileGroupProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSecurityProfileGroupProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileGroupProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSecurityProfile', () => { + it('invokes createSecurityProfile without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfile without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfile with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSecurityProfile with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.CreateSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.CreateSecurityProfileRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSecurityProfileProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkCreateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSecurityProfileProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSecurityProfile', () => { + it('invokes updateSecurityProfile without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfile without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networksecurity.v1.ISecurityProfile, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfile with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSecurityProfile with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest(), + ); + request.securityProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.UpdateSecurityProfileRequest', + ['securityProfile', 'name'], + ); + request.securityProfile.name = defaultValue1; + const expectedHeaderRequestParams = `security_profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSecurityProfileProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkUpdateSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSecurityProfileProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSecurityProfile', () => { + it('invokes deleteSecurityProfile without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSecurityProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfile without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSecurityProfile = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecurityProfile( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networksecurity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfile with call error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteSecurityProfile(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSecurityProfile with LRO error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.DeleteSecurityProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecurityProfile = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSecurityProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSecurityProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSecurityProfileProgress without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.checkDeleteSecurityProfileProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSecurityProfileProgress with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSecurityProfileProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSecurityProfileGroups', () => { + it('invokes listSecurityProfileGroups without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfileGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfileGroups without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.innerApiCalls.listSecurityProfileGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfileGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfileGroups with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfileGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listSecurityProfileGroups(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfileGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfileGroupsStream without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + ) => { + 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.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('invokes listSecurityProfileGroupsStream with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfileGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfileGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfileGroup, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfileGroups, request), + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listSecurityProfileGroups without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfileGroup(), + ), + ]; + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = + []; + const iterable = client.listSecurityProfileGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listSecurityProfileGroups with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfileGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfileGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfileGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfileGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listSecurityProfileGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listSecurityProfiles', () => { + it('invokes listSecurityProfiles without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCall(expectedResponse); + const [response] = await client.listSecurityProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfiles without error using callback', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.innerApiCalls.listSecurityProfiles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecurityProfiles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networksecurity.v1.ISecurityProfile[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfiles with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecurityProfiles = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSecurityProfiles(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSecurityProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSecurityProfilesStream without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfile, + ) => { + 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.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listSecurityProfilesStream with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecurityProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networksecurity.v1.SecurityProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networksecurity.v1.SecurityProfile, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSecurityProfiles, request), + ); + assert( + (client.descriptors.page.listSecurityProfiles.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSecurityProfiles without error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + generateSampleMessage( + new protos.google.cloud.networksecurity.v1.SecurityProfile(), + ), + ]; + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = + []; + const iterable = client.listSecurityProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSecurityProfiles with error', async () => { + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networksecurity.v1.ListSecurityProfilesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networksecurity.v1.ListSecurityProfilesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSecurityProfiles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecurityProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networksecurity.v1.ISecurityProfile[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSecurityProfiles.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSecurityProfiles.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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + 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.IOperation[] = []; + 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 securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await 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.IOperation[] = []; + 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('authorizationPolicy', async () => { + const fakePath = '/rendered/path/authorizationPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authorization_policy: 'authorizationPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authorizationPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authorizationPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authorizationPolicyPath', () => { + const result = client.authorizationPolicyPath( + 'projectValue', + 'locationValue', + 'authorizationPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthorizationPolicyName', () => { + const result = client.matchProjectFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthorizationPolicyName', () => { + const result = + client.matchLocationFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthorizationPolicyFromAuthorizationPolicyName', () => { + const result = + client.matchAuthorizationPolicyFromAuthorizationPolicyName(fakePath); + assert.strictEqual(result, 'authorizationPolicyValue'); + assert( + ( + client.pathTemplates.authorizationPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('authzPolicy', async () => { + const fakePath = '/rendered/path/authzPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + authz_policy: 'authzPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.authzPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.authzPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('authzPolicyPath', () => { + const result = client.authzPolicyPath( + 'projectValue', + 'locationValue', + 'authzPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.authzPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAuthzPolicyName', () => { + const result = client.matchProjectFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAuthzPolicyName', () => { + const result = client.matchLocationFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAuthzPolicyFromAuthzPolicyName', () => { + const result = client.matchAuthzPolicyFromAuthzPolicyName(fakePath); + assert.strictEqual(result, 'authzPolicyValue'); + assert( + (client.pathTemplates.authzPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('backendAuthenticationConfig', async () => { + const fakePath = '/rendered/path/backendAuthenticationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backend_authentication_config: 'backendAuthenticationConfigValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backendAuthenticationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backendAuthenticationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backendAuthenticationConfigPath', () => { + const result = client.backendAuthenticationConfigPath( + 'projectValue', + 'locationValue', + 'backendAuthenticationConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackendAuthenticationConfigName', () => { + const result = + client.matchProjectFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackendAuthenticationConfigName', () => { + const result = + client.matchLocationFromBackendAuthenticationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackendAuthenticationConfigFromBackendAuthenticationConfigName', () => { + const result = + client.matchBackendAuthenticationConfigFromBackendAuthenticationConfigName( + fakePath, + ); + assert.strictEqual(result, 'backendAuthenticationConfigValue'); + assert( + ( + client.pathTemplates.backendAuthenticationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('clientTlsPolicy', async () => { + const fakePath = '/rendered/path/clientTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + client_tls_policy: 'clientTlsPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.clientTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clientTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clientTlsPolicyPath', () => { + const result = client.clientTlsPolicyPath( + 'projectValue', + 'locationValue', + 'clientTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClientTlsPolicyName', () => { + const result = client.matchProjectFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClientTlsPolicyName', () => { + const result = client.matchLocationFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClientTlsPolicyFromClientTlsPolicyName', () => { + const result = + client.matchClientTlsPolicyFromClientTlsPolicyName(fakePath); + assert.strictEqual(result, 'clientTlsPolicyValue'); + assert( + (client.pathTemplates.clientTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('dnsThreatDetector', async () => { + const fakePath = '/rendered/path/dnsThreatDetector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + dns_threat_detector: 'dnsThreatDetectorValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.dnsThreatDetectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsThreatDetectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsThreatDetectorPath', () => { + const result = client.dnsThreatDetectorPath( + 'projectValue', + 'locationValue', + 'dnsThreatDetectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsThreatDetectorName', () => { + const result = client.matchProjectFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsThreatDetectorName', () => { + const result = client.matchLocationFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDnsThreatDetectorFromDnsThreatDetectorName', () => { + const result = + client.matchDnsThreatDetectorFromDnsThreatDetectorName(fakePath); + assert.strictEqual(result, 'dnsThreatDetectorValue'); + assert( + ( + client.pathTemplates.dnsThreatDetectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('firewallEndpointAssociation', async () => { + const fakePath = '/rendered/path/firewallEndpointAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint_association: 'firewallEndpointAssociationValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.firewallEndpointAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firewallEndpointAssociationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('firewallEndpointAssociationPath', () => { + const result = client.firewallEndpointAssociationPath( + 'projectValue', + 'locationValue', + 'firewallEndpointAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFirewallEndpointAssociationName', () => { + const result = + client.matchProjectFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromFirewallEndpointAssociationName', () => { + const result = + client.matchLocationFromFirewallEndpointAssociationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointAssociationFromFirewallEndpointAssociationName', () => { + const result = + client.matchFirewallEndpointAssociationFromFirewallEndpointAssociationName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointAssociationValue'); + assert( + ( + client.pathTemplates.firewallEndpointAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicy', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyPath', () => { + const result = client.gatewaySecurityPolicyPath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('gatewaySecurityPolicyRule', async () => { + const fakePath = '/rendered/path/gatewaySecurityPolicyRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + gateway_security_policy: 'gatewaySecurityPolicyValue', + rule: 'ruleValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('gatewaySecurityPolicyRulePath', () => { + const result = client.gatewaySecurityPolicyRulePath( + 'projectValue', + 'locationValue', + 'gatewaySecurityPolicyValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchProjectFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchLocationFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchGatewaySecurityPolicyFromGatewaySecurityPolicyRuleName( + fakePath, + ); + assert.strictEqual(result, 'gatewaySecurityPolicyValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromGatewaySecurityPolicyRuleName', () => { + const result = + client.matchRuleFromGatewaySecurityPolicyRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + ( + client.pathTemplates.gatewaySecurityPolicyRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeployment', async () => { + const fakePath = '/rendered/path/interceptDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment: 'interceptDeploymentValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentPath', () => { + const result = client.interceptDeploymentPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentName', () => { + const result = client.matchProjectFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentName', () => { + const result = + client.matchLocationFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentFromInterceptDeploymentName', () => { + const result = + client.matchInterceptDeploymentFromInterceptDeploymentName(fakePath); + assert.strictEqual(result, 'interceptDeploymentValue'); + assert( + ( + client.pathTemplates.interceptDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptDeploymentGroup', async () => { + const fakePath = '/rendered/path/interceptDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_deployment_group: 'interceptDeploymentGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptDeploymentGroupPath', () => { + const result = client.interceptDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'interceptDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptDeploymentGroupName', () => { + const result = + client.matchProjectFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptDeploymentGroupName', () => { + const result = + client.matchLocationFromInterceptDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptDeploymentGroupFromInterceptDeploymentGroupName', () => { + const result = + client.matchInterceptDeploymentGroupFromInterceptDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptDeploymentGroupValue'); + assert( + ( + client.pathTemplates.interceptDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroup', async () => { + const fakePath = '/rendered/path/interceptEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group: 'interceptEndpointGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interceptEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interceptEndpointGroupPath', () => { + const result = client.interceptEndpointGroupPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupFromInterceptEndpointGroupName', () => { + const result = + client.matchInterceptEndpointGroupFromInterceptEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('interceptEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/interceptEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intercept_endpoint_group_association: + 'interceptEndpointGroupAssociationValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interceptEndpointGroupAssociationPath', () => { + const result = client.interceptEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'interceptEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName', () => { + const result = + client.matchInterceptEndpointGroupAssociationFromInterceptEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'interceptEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.interceptEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringDeployment', async () => { + const fakePath = '/rendered/path/mirroringDeployment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment: 'mirroringDeploymentValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentPath', () => { + const result = client.mirroringDeploymentPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentName', () => { + const result = client.matchProjectFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentName', () => { + const result = + client.matchLocationFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentFromMirroringDeploymentName', () => { + const result = + client.matchMirroringDeploymentFromMirroringDeploymentName(fakePath); + assert.strictEqual(result, 'mirroringDeploymentValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringDeploymentGroup', async () => { + const fakePath = '/rendered/path/mirroringDeploymentGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_deployment_group: 'mirroringDeploymentGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringDeploymentGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringDeploymentGroupPath', () => { + const result = client.mirroringDeploymentGroupPath( + 'projectValue', + 'locationValue', + 'mirroringDeploymentGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringDeploymentGroupName', () => { + const result = + client.matchProjectFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringDeploymentGroupName', () => { + const result = + client.matchLocationFromMirroringDeploymentGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringDeploymentGroupFromMirroringDeploymentGroupName', () => { + const result = + client.matchMirroringDeploymentGroupFromMirroringDeploymentGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringDeploymentGroupValue'); + assert( + ( + client.pathTemplates.mirroringDeploymentGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroup', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group: 'mirroringEndpointGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.mirroringEndpointGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('mirroringEndpointGroupPath', () => { + const result = client.mirroringEndpointGroupPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupFromMirroringEndpointGroupName', () => { + const result = + client.matchMirroringEndpointGroupFromMirroringEndpointGroupName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('mirroringEndpointGroupAssociation', async () => { + const fakePath = '/rendered/path/mirroringEndpointGroupAssociation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + mirroring_endpoint_group_association: + 'mirroringEndpointGroupAssociationValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('mirroringEndpointGroupAssociationPath', () => { + const result = client.mirroringEndpointGroupAssociationPath( + 'projectValue', + 'locationValue', + 'mirroringEndpointGroupAssociationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchProjectFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchLocationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName', () => { + const result = + client.matchMirroringEndpointGroupAssociationFromMirroringEndpointGroupAssociationName( + fakePath, + ); + assert.strictEqual(result, 'mirroringEndpointGroupAssociationValue'); + assert( + ( + client.pathTemplates.mirroringEndpointGroupAssociationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organization', async () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocation', async () => { + const fakePath = '/rendered/path/organizationLocation'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationLocationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationLocationPath', () => { + const result = client.organizationLocationPath( + 'organizationValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationName', () => { + const result = + client.matchOrganizationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationName', () => { + const result = + client.matchLocationFromOrganizationLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationAddressGroup', async () => { + const fakePath = '/rendered/path/organizationLocationAddressGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationAddressGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationAddressGroupPath', () => { + const result = client.organizationLocationAddressGroupPath( + 'organizationValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromOrganizationLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromOrganizationLocationAddressGroupName( + fakePath, + ); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.organizationLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/organizationLocationFirewallEndpoints'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationFirewallEndpointsPath', () => { + const result = client.organizationLocationFirewallEndpointsPath( + 'organizationValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchOrganizationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromOrganizationLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates + .organizationLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/organizationLocationSecurityProfile'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfilePath', () => { + const result = client.organizationLocationSecurityProfilePath( + 'organizationValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromOrganizationLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromOrganizationLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.organizationLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationLocationSecurityProfileGroup', async () => { + const fakePath = + '/rendered/path/organizationLocationSecurityProfileGroup'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationSecurityProfileGroupPath', () => { + const result = client.organizationLocationSecurityProfileGroupPath( + 'organizationValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchOrganizationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromOrganizationLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates + .organizationLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationAddressGroup', async () => { + const fakePath = '/rendered/path/projectLocationAddressGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + address_group: 'addressGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationAddressGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAddressGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAddressGroupPath', () => { + const result = client.projectLocationAddressGroupPath( + 'projectValue', + 'locationValue', + 'addressGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationAddressGroupName', () => { + const result = + client.matchProjectFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationAddressGroupName', () => { + const result = + client.matchLocationFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAddressGroupFromProjectLocationAddressGroupName', () => { + const result = + client.matchAddressGroupFromProjectLocationAddressGroupName(fakePath); + assert.strictEqual(result, 'addressGroupValue'); + assert( + ( + client.pathTemplates.projectLocationAddressGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationFirewallEndpoints', async () => { + const fakePath = '/rendered/path/projectLocationFirewallEndpoints'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + firewall_endpoint: 'firewallEndpointValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationFirewallEndpointsPath', () => { + const result = client.projectLocationFirewallEndpointsPath( + 'projectValue', + 'locationValue', + 'firewallEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchProjectFromProjectLocationFirewallEndpointsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchLocationFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFirewallEndpointFromProjectLocationFirewallEndpointsName', () => { + const result = + client.matchFirewallEndpointFromProjectLocationFirewallEndpointsName( + fakePath, + ); + assert.strictEqual(result, 'firewallEndpointValue'); + assert( + ( + client.pathTemplates.projectLocationFirewallEndpointsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfile', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile: 'securityProfileValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfilePath', () => { + const result = client.projectLocationSecurityProfilePath( + 'projectValue', + 'locationValue', + 'securityProfileValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileFromProjectLocationSecurityProfileName', () => { + const result = + client.matchSecurityProfileFromProjectLocationSecurityProfileName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectLocationSecurityProfileGroup', async () => { + const fakePath = '/rendered/path/projectLocationSecurityProfileGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_profile_group: 'securityProfileGroupValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationSecurityProfileGroupPath', () => { + const result = client.projectLocationSecurityProfileGroupPath( + 'projectValue', + 'locationValue', + 'securityProfileGroupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchProjectFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchLocationFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName', () => { + const result = + client.matchSecurityProfileGroupFromProjectLocationSecurityProfileGroupName( + fakePath, + ); + assert.strictEqual(result, 'securityProfileGroupValue'); + assert( + ( + client.pathTemplates.projectLocationSecurityProfileGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACAttachment', async () => { + const fakePath = '/rendered/path/sACAttachment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_attachment: 'sacAttachmentValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACAttachmentPath', () => { + const result = client.sACAttachmentPath( + 'projectValue', + 'locationValue', + 'sacAttachmentValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACAttachmentName', () => { + const result = client.matchProjectFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACAttachmentName', () => { + const result = client.matchLocationFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacAttachmentFromSACAttachmentName', () => { + const result = client.matchSacAttachmentFromSACAttachmentName(fakePath); + assert.strictEqual(result, 'sacAttachmentValue'); + assert( + (client.pathTemplates.sACAttachmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('sACRealm', async () => { + const fakePath = '/rendered/path/sACRealm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + sac_realm: 'sacRealmValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.sACRealmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sACRealmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sACRealmPath', () => { + const result = client.sACRealmPath( + 'projectValue', + 'locationValue', + 'sacRealmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sACRealmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSACRealmName', () => { + const result = client.matchProjectFromSACRealmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSACRealmName', () => { + const result = client.matchLocationFromSACRealmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSacRealmFromSACRealmName', () => { + const result = client.matchSacRealmFromSACRealmName(fakePath); + assert.strictEqual(result, 'sacRealmValue'); + assert( + (client.pathTemplates.sACRealmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('serverTlsPolicy', async () => { + const fakePath = '/rendered/path/serverTlsPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + server_tls_policy: 'serverTlsPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.serverTlsPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serverTlsPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serverTlsPolicyPath', () => { + const result = client.serverTlsPolicyPath( + 'projectValue', + 'locationValue', + 'serverTlsPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServerTlsPolicyName', () => { + const result = client.matchProjectFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromServerTlsPolicyName', () => { + const result = client.matchLocationFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServerTlsPolicyFromServerTlsPolicyName', () => { + const result = + client.matchServerTlsPolicyFromServerTlsPolicyName(fakePath); + assert.strictEqual(result, 'serverTlsPolicyValue'); + assert( + (client.pathTemplates.serverTlsPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('tlsInspectionPolicy', async () => { + const fakePath = '/rendered/path/tlsInspectionPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + tls_inspection_policy: 'tlsInspectionPolicyValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.tlsInspectionPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tlsInspectionPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tlsInspectionPolicyPath', () => { + const result = client.tlsInspectionPolicyPath( + 'projectValue', + 'locationValue', + 'tlsInspectionPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTlsInspectionPolicyName', () => { + const result = client.matchProjectFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTlsInspectionPolicyName', () => { + const result = + client.matchLocationFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTlsInspectionPolicyFromTlsInspectionPolicyName', () => { + const result = + client.matchTlsInspectionPolicyFromTlsInspectionPolicyName(fakePath); + assert.strictEqual(result, 'tlsInspectionPolicyValue'); + assert( + ( + client.pathTemplates.tlsInspectionPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('urlList', async () => { + const fakePath = '/rendered/path/urlList'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + url_list: 'urlListValue', + }; + const client = + new securityprofilegroupserviceModule.v1.SecurityProfileGroupServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.urlListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.urlListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('urlListPath', () => { + const result = client.urlListPath( + 'projectValue', + 'locationValue', + 'urlListValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.urlListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUrlListName', () => { + const result = client.matchProjectFromUrlListName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUrlListName', () => { + const result = client.matchLocationFromUrlListName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUrlListFromUrlListName', () => { + const result = client.matchUrlListFromUrlListName(fakePath); + assert.strictEqual(result, 'urlListValue'); + assert( + (client.pathTemplates.urlListPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-networksecurity/webpack.config.js b/packages/google-cloud-networksecurity/webpack.config.js index d7eed26cf2a1..5800478ef4e4 100644 --- a/packages/google-cloud-networksecurity/webpack.config.js +++ b/packages/google-cloud-networksecurity/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.